linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] md: bcache: io.c: fix a potential NULL pointer dereference
@ 2013-05-28  7:31 Kumar Amit Mehta
       [not found] ` <1369726275-5424-1-git-send-email-gmate.amit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Kumar Amit Mehta @ 2013-05-28  7:31 UTC (permalink / raw)
  To: koverstreet-hpIqsD4AKlfQT0dZR+AlfA
  Cc: neilb-l3A5Bk7waGM, linux-bcache-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/md/bcache/io.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index 29f344b..4be2a07 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -98,6 +98,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;
 	}
-- 
1.7.10.4

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

end of thread, other threads:[~2013-05-29  0:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-28  7:31 [PATCH] md: bcache: io.c: fix a potential NULL pointer dereference Kumar Amit Mehta
     [not found] ` <1369726275-5424-1-git-send-email-gmate.amit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-29  0:20   ` Kent Overstreet
     [not found]     ` <20130529002041.GC2291-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2013-05-29  0:01       ` Kumar amit mehta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).