linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kumar Amit Mehta <gmate.amit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org
Cc: neilb-l3A5Bk7waGM@public.gmane.org,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-raid-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] md: bcache: io.c: fix a potential NULL pointer dereference
Date: Tue, 28 May 2013 00:31:15 -0700	[thread overview]
Message-ID: <1369726275-5424-1-git-send-email-gmate.amit@gmail.com> (raw)

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

             reply	other threads:[~2013-05-28  7:31 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369726275-5424-1-git-send-email-gmate.amit@gmail.com \
    --to=gmate.amit-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-raid-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=neilb-l3A5Bk7waGM@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).