linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] raid5: fix possible oops in add_stripe_bio when enable pr_debug
@ 2012-09-22  2:22 Jianpeng Ma
  0 siblings, 0 replies; only message in thread
From: Jianpeng Ma @ 2012-09-22  2:22 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid

In function add_stripe_bio:
>> .....
>>		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 <majianpeng@gmail.com>
---
 drivers/md/raid5.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index dd73209..a56aa5b 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2360,6 +2360,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in
 	struct 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, in
 	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)sector,
 		(unsigned long long)sh->sector, dd_idx);
 
 	if (conf->mddev->bitmap && firstwrite) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-22  2:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-22  2:22 [PATCH 2/3] raid5: fix possible oops in add_stripe_bio when enable pr_debug Jianpeng Ma

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