Skip to contentSkip to conversation

Fix a potential NULL dereference in md/raid1

PATCH-stable16 Applied NeilBrown 2 participants 5 messages Aug 20, 2006 – Aug 26, 2006 1 message not in the archive MD RAID

lore
Share & tools
lore

NeilBrown

author
#1 lore raw
In reply to a message not in the archive

patch for 2.6.16 stable series

My applogies to people reading this with a window narrower than 111 characters :-(

NeilBrown

### Comments for Changeset

At the point where this 'atomic_add' is, rdev could be NULL, as seen by the fact that we test for this in the very next statement.
Further is it is really the wrong place of the add. We could add to the count of corrected errors
once the are sure it was corrected, not before trying to correct it.

### Diffstat output

 ./drivers/md/raid1.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/raid1.c +3 -1
diff .prev/drivers/md/raid1.c ./drivers/md/raid1.c
@@ -1467,7 +1467,6 @@ static void raid1d(mddev_t *mddev)
 							d = conf->raid_disks;
 						d--;
 						rdev = conf->mirrors[d].rdev;
-						atomic_add(s, &rdev->corrected_errors);
 						if (rdev &&
 						    test_bit(In_sync, &rdev->flags)) {
 							if (sync_page_io(rdev->bdev,
@@ -1490,6 +1489,9 @@ static void raid1d(mddev_t *mddev)
 									 s<<9, conf->tmppage, READ) == 0)
 								/* Well, this device is dead */
 								md_error(mddev, rdev);
+							else
+								atomic_add(s, &rdev->corrected_errors);
+
 						}
 					}
 				} else {
#2 lore raw
Quoted 2 lines · NeilBrown

patch for 2.6.16 stable series
...

Thanks for this patch.

It does also apply against both 2.6.17.9 and Linus' tree.

Is it not required in these trees, or are you also submitting it there?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
author
#3 lore raw
Quoted 10 lines · On Monday August 21, [email protected] wrote:
Quoted 2 lines · NeilBrown

patch for 2.6.16 stable series
...

Thanks for this patch.

It does also apply against both 2.6.17.9 and Linus' tree.

Is it not required in these trees, or are you also submitting it there?

I've just sent a patch to [email protected] for 2.6.17.9. (it is the same patch with slightly different line numbers).

The patch for -linus is quite different and will follow shortly (with a few other patches).

Thanks,
NeilBrown

#4 lore raw
Quoted 10 lines · Neil Brown
Quoted 9 lines · On Monday August 21, [email protected] wrote:
Quoted 2 lines · NeilBrown

patch for 2.6.16 stable series
...

Thanks for this patch.

It does also apply against both 2.6.17.9 and Linus' tree.

Quoted 7 lines
Quoted 1 line

Is it not required in these trees, or are you also submitting it there?

I've just sent a patch to [email protected] for 2.6.17.9. (it is the same patch with slightly different line numbers).

The patch for -linus is quite different and will follow shortly (with a few other patches).

OK, I'll apply this patch when it has successfully passed 2.6.17 review and got included in 2.6.17.

Quoted 2 lines

Thanks,
NeilBrown

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
Applied
#5 lore raw
Quoted 13 lines · Adrian Bunk
Quoted 12 lines · Neil Brown
Quoted 10 lines · On Monday August 21, [email protected] wrote:
Quoted 2 lines · NeilBrown

patch for 2.6.16 stable series
...

Thanks for this patch.

It does also apply against both 2.6.17.9 and Linus' tree.

Is it not required in these trees, or are you also submitting it there?

Quoted 8 lines
Quoted 5 lines

I've just sent a patch to [email protected] for 2.6.17.9. (it is the same patch with slightly different line numbers).

The patch for -linus is quite different and will follow shortly (with a few other patches).

OK, I'll apply this patch when it has successfully passed 2.6.17 review and got included in 2.6.17.

Applied, thanks for the patch.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed