Messages in this thread Patch in this message | | | From | Jia-Ju Bai <> | Subject | [PATCH] md: bcache: fix error return code of cached_dev_cache_miss() | Date | Thu, 4 Mar 2021 18:46:09 -0800 |
| |
When bch_bio_alloc_pages() fails, no error return code of cached_dev_cache_miss() is assigned. To fix this bug, ret is assigned with -ENOMEN as error return code.
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> --- drivers/md/bcache/request.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 29c231758293..9ecaf26c8d60 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -930,8 +930,10 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, cache_bio->bi_private = &s->cl; bch_bio_map(cache_bio, NULL); - if (bch_bio_alloc_pages(cache_bio, __GFP_NOWARN|GFP_NOIO)) + if (bch_bio_alloc_pages(cache_bio, __GFP_NOWARN|GFP_NOIO)) { + ret = -ENOMEM; goto out_put; + } if (reada) bch_mark_cache_readahead(s->iop.c, s->d); -- 2.17.1
| |