public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] bcache: Fix potential NULL pointer dereference
@ 2019-01-30 10:21 YueHaibing
  2019-01-30 10:58 ` Kent Overstreet
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2019-01-30 10:21 UTC (permalink / raw)
  To: colyli, kent.overstreet; +Cc: linux-kernel, linux-bcache, YueHaibing

There is a potential NULL pointer dereference in case
kzalloc() fails and returns NULL.

Fixes: bc082a55d25c ("bcache: fix inaccurate io state for detached bcache devices")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/md/bcache/request.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 1507041..a50afa4 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1094,6 +1094,8 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio)
 	 * which would call closure_get(&dc->disk.cl)
 	 */
 	ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
+	if (!ddip)
+		return;
 	ddip->d = d;
 	ddip->start_time = jiffies;
 	ddip->bi_end_io = bio->bi_end_io;
-- 
2.7.0

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

end of thread, other threads:[~2019-02-01  2:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-30 10:21 [PATCH -next] bcache: Fix potential NULL pointer dereference YueHaibing
2019-01-30 10:58 ` Kent Overstreet
2019-02-01  2:36   ` YueHaibing

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