From: Kumar Amit Mehta Date: Tue, 28 May 2013 07:31:15 +0000 (-0700) Subject: md: bcache: io.c: fix a potential NULL pointer dereference X-Git-Tag: v3.10.10~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba5c60fc8f5f574c7cec70740ca19d358b780c57;p=platform%2Fkernel%2Flinux-3.10.git md: bcache: io.c: fix a potential NULL pointer dereference commit 5c694129c8db6d89c9be109049a16510b2f70f6d upstream. bio_alloc_bioset returns NULL on failure. This fix adds a missing check for potential NULL pointer dereferencing. Signed-off-by: Kumar Amit Mehta Signed-off-by: Kent Overstreet Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index 48efd4d..d285cd4 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c @@ -97,6 +97,8 @@ struct bio *bch_bio_split(struct bio *bio, int sectors, if (bio->bi_rw & REQ_DISCARD) { ret = bio_alloc_bioset(gfp, 1, bs); + if (!ret) + return NULL; idx = 0; goto out; }