raid5: fix possible oops in add_stripe_bio when enable pr_debug
PATCH 2/3 raid5: fix possible oops in add_stripe_bio when enable pr_debug
In function add_stripe_bio:
Quoted 8 lines
Quoted 8 lines
.....
bip = &sh->dev[dd_idx].toread;......
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);
After spin_unlock_irq, this thread scheded and toread may become null. So it will be oops.
Signed-off-by Jianpeng Ma <[email protected]>
--- drivers/md/raid5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/raid5.c +2 -1
@@ -2360,6 +2360,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, instruct bio **bip;struct r5conf *conf = sh->raid_conf;int firstwrite=0 ; +sector_t sector = bi->bi_sector; pr_debug("adding bi b#%llu to stripe s#%llu\n", (unsigned long long)bi->bi_sector,
@@ -2410,7 +2411,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, inspin_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 )sector, (unsigned long long )sh->sector, dd_idx);if (conf->mddev->bitmap && firstwrite) {
Signature · 1 line
1.7.9.5