From 9bd2c7ca75b0ebe05b0c67852d050720119983e7 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 30 Apr 2008 18:55:30 +0000 Subject: [PATCH] md: fix use after free when removing rdev via sysfs commit: 6a51830e14529063cb2685921e1177d9af50e49a upstream rdev->mddev is no longer valid upon return from entry->store() when the 'remove' command is given. Signed-off-by: Dan Williams Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 61ccbd2683fa..9f6d228b5607 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2096,7 +2096,7 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr, rv = -EBUSY; else rv = entry->store(rdev, page, length); - mddev_unlock(rdev->mddev); + mddev_unlock(mddev); } return rv; } -- 2.39.5