From: NeilBrown Date: Tue, 25 Sep 2012 07:00:44 +0000 (+1000) Subject: md/raid5: protect debug message against NULL derefernce. X-Git-Tag: next-20120926~52^2~2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8007c32261351afd5f2eb64f9e21e1cb2beaa235;p=karo-tx-linux.git md/raid5: protect debug message against NULL derefernce. The pr_debug in add_stripe_bio could race with something changing *bip, so it is best to hold the lock until after the pr_debug. Reported-by: "Jianpeng Ma" Signed-off-by: NeilBrown --- diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index c09a1aaa0cb7..99e766d3fcce 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -2477,11 +2477,11 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in if (sector >= sh->dev[dd_idx].sector + STRIPE_SECTORS) set_bit(R5_OVERWRITE, &sh->dev[dd_idx].flags); } - spin_unlock_irq(&sh->stripe_lock); pr_debug("added bi b#%llu to stripe s#%llu, disk %d.\n", (unsigned long long)(*bip)->bi_sector, (unsigned long long)sh->sector, dd_idx); + spin_unlock_irq(&sh->stripe_lock); if (conf->mddev->bitmap && firstwrite) { bitmap_startwrite(conf->mddev->bitmap, sh->sector,