linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Adrian Bunk <bunk@stusta.de>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH-stable16] Fix a potential NULL dereference in md/raid1
Date: Mon, 21 Aug 2006 09:50:13 +1000	[thread overview]
Message-ID: <1060820235013.22016@suse.de> (raw)
In-Reply-To: 20060821094833.21982.patches@notabene

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.

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/raid1.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff .prev/drivers/md/raid1.c ./drivers/md/raid1.c
--- .prev/drivers/md/raid1.c	2006-08-21 09:47:57.000000000 +1000
+++ ./drivers/md/raid1.c	2006-08-21 09:43:37.000000000 +1000
@@ -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 {

       reply	other threads:[~2006-08-20 23:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060821094833.21982.patches@notabene>
2006-08-20 23:50 ` NeilBrown [this message]
2006-08-21  0:01   ` [PATCH-stable16] Fix a potential NULL dereference in md/raid1 Adrian Bunk
2006-08-21  0:07     ` Neil Brown
2006-08-21  0:28       ` Adrian Bunk
2006-08-26 15:33         ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1060820235013.22016@suse.de \
    --to=neilb@suse.de \
    --cc=bunk@stusta.de \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).