linux-kernel.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
  2013-05-29  0:20 ` Kent Overstreet
  0 siblings, 1 reply; 3+ messages in thread
From: Kumar Amit Mehta @ 2013-05-28  7:31 UTC (permalink / raw)
  To: koverstreet
  Cc: neilb, linux-bcache, linux-raid, linux-kernel, kernel-janitors

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>
---
 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  5:36 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
2013-05-29  0:20 ` Kent Overstreet
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).