* [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
* Re: [PATCH] md: bcache: io.c: fix a potential NULL pointer dereference
[not found] ` <20130529002041.GC2291-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
@ 2013-05-29 0:01 ` Kumar amit mehta
0 siblings, 0 replies; 3+ messages in thread
From: Kumar amit mehta @ 2013-05-29 0:01 UTC (permalink / raw)
To: Kent Overstreet
Cc: neilb-l3A5Bk7waGM, linux-bcache-u79uwXL29TY76Z2rM5mHXA,
linux-raid-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On Tue, May 28, 2013 at 05:20:41PM -0700, Kent Overstreet wrote:
> On Tue, May 28, 2013 at 12:31:15AM -0700, Kumar Amit Mehta wrote:
> > bio_alloc_bioset returns NULL on failure. This fix adds a missing check
> > for potential NULL pointer dereferencing.
>
> Whoops, that's definitely a bug. Thanks, applied.
>
> How'd you find it?
Using smatch[1]
[1] http://smatch.sourceforge.net/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] md: bcache: io.c: fix a potential NULL pointer dereference
[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>
0 siblings, 1 reply; 3+ messages in thread
From: Kent Overstreet @ 2013-05-29 0:20 UTC (permalink / raw)
To: Kumar Amit Mehta
Cc: neilb-l3A5Bk7waGM, linux-bcache-u79uwXL29TY76Z2rM5mHXA,
linux-raid-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On Tue, May 28, 2013 at 12:31:15AM -0700, Kumar Amit Mehta wrote:
> bio_alloc_bioset returns NULL on failure. This fix adds a missing check
> for potential NULL pointer dereferencing.
Whoops, that's definitely a bug. Thanks, applied.
How'd you find it?
^ permalink raw reply [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).