summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKumar Amit Mehta <gmate.amit@gmail.com>2013-05-28 00:31:15 -0700
committerKent Overstreet <koverstreet@google.com>2013-06-26 17:06:19 -0700
commit5c694129c8db6d89c9be109049a16510b2f70f6d (patch)
tree9d6e5a0bf91285f28e89407c2367cf026dcf88ad
parent9e895ace5d82df8929b16f58e9f515f6d54ab82d (diff)
md: bcache: io.c: fix a potential NULL pointer dereference
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>
-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 48efd4dea645..d285cd49104c 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;
}