On Tue, Apr 02 2019, Yufen Yu wrote: > We add rdev->mddev->pers to avoid potential NULL pointer derefence > in fallowing add_bound_rdev(). > > Cc: Xiao Ni <xni@xxxxxxxxxx> > Cc: NeilBrown <neilb@xxxxxxxx> > Signed-off-by: Yufen Yu <yuyufen@xxxxxxxxxx> Thanks. I think the driver does need this fix, however: - with your patch it will return -EBUSY if an error is found. I think it should return -EINVAL (as nothing is busy). - It would be good to include Fixes: a6da4ef85cef ("md: re-add a failed disk") in the commit message. Thanks, NeilBrown > --- > drivers/md/md.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/md.c b/drivers/md/md.c > index 875b29ba5926..96cdad28a0d2 100644 > --- a/drivers/md/md.c > +++ b/drivers/md/md.c > @@ -2859,8 +2859,8 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) > err = 0; > } > } else if (cmd_match(buf, "re-add")) { > - if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1) && > - rdev->saved_raid_disk >= 0) { > + if (rdev->mddev->pers && test_bit(Faulty, &rdev->flags) && > + (rdev->raid_disk == -1) && rdev->saved_raid_disk >= 0) { > /* clear_bit is performed _after_ all the devices > * have their local Faulty bit cleared. If any writes > * happen in the meantime in the local node, they > -- > 2.16.2.dirty
Attachment:
signature.asc
Description: PGP signature