mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] md: bcache: check the return value of mempool_alloc() in bch_btree_node_read_done()
@ 2022-02-25  8:28 Jia-Ju Bai
  2022-03-02 10:29 ` Coly Li
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2022-02-25  8:28 UTC (permalink / raw)
  To: colyli, kent.overstreet; +Cc: linux-bcache, linux-kernel, Jia-Ju Bai

The function mempool_alloc() in bch_btree_node_read_done() can fail, so
its return value should be checked.

Fixes: d19936a26658 ("bcache: convert to bioset_init()/mempool_init()")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/md/bcache/btree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 88c573eeb598..fb8b7dd6bcc2 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -157,6 +157,8 @@ void bch_btree_node_read_done(struct btree *b)
 	 * See the comment arount cache_set->fill_iter.
 	 */
 	iter = mempool_alloc(&b->c->fill_iter, GFP_NOIO);
+	if (!iter)
+		return;
 	iter->size = b->c->cache->sb.bucket_size / b->c->cache->sb.block_size;
 	iter->used = 0;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-02 10:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25  8:28 [PATCH] md: bcache: check the return value of mempool_alloc() in bch_btree_node_read_done() Jia-Ju Bai
2022-03-02 10:29 ` Coly Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®