summaryrefslogtreecommitdiff
path: root/drivers/md/bcache
diff options
context:
space:
mode:
authorKumar Amit Mehta <gmate.amit@gmail.com>2013-05-28 00:31:15 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-29 09:47:40 -0700
commitba5c60fc8f5f574c7cec70740ca19d358b780c57 (patch)
treee5142cafb4422d696970fa54e8a3f20d5710c879 /drivers/md/bcache
parent644f5d570740c90439fdf69e8b47647584c6dc2f (diff)
downloadlinux-3.10-ba5c60fc8f5f574c7cec70740ca19d358b780c57.tar.gz
linux-3.10-ba5c60fc8f5f574c7cec70740ca19d358b780c57.tar.bz2
linux-3.10-ba5c60fc8f5f574c7cec70740ca19d358b780c57.zip
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 <gmate.amit@gmail.com> Signed-off-by: Kent Overstreet <koverstreet@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/bcache')
-rw-r--r--drivers/md/bcache/io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index 48efd4dea64..d285cd49104 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;
}