linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RAID0] Possible bug in raid0_make_request() function
@ 2012-05-17  6:50 Anuj Goel
  2012-05-17  7:09 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Anuj Goel @ 2012-05-17  6:50 UTC (permalink / raw)
  To: Linux RAID

Hi Guys,
I was going through the RAID0 code and found that there could be a
possible bug in the raid0_make_request() function.

Consider the below snippet of this function.

/* This is a one page bio that upper layers
* refuse to split for us, so we need to split it.
*/
if (likely(is_power_of_2(chunk_sects)))
bp = bio_split(bio, chunk_sects - (sector &
  (chunk_sects-1)));
else
bp = bio_split(bio, chunk_sects -
      sector_div(sector, chunk_sects));
raid0_make_request(mddev, &bp->bio1);
raid0_make_request(mddev, &bp->bio2);
bio_pair_release(bp);
return;

In function bio_split(..), if mempool_alloc() fails, we return NULL into bp.
Now the call raid0_make_request(mddev, &bp->bio1) does not check for
bp to be not NULL before de-referencing it.

Could this be a problem ?

--
Best Regards,
Anuj Goel
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2012-05-17  7:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-17  6:50 [RAID0] Possible bug in raid0_make_request() function Anuj Goel
2012-05-17  7:09 ` NeilBrown

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).