From 6a51830e14529063cb2685921e1177d9af50e49a Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 30 Apr 2008 00:52:28 -0700 Subject: [PATCH] md: fix use after free when removing rdev via sysfs rdev->mddev is no longer valid upon return from entry->store() when the 'remove' command is given. Cc: Signed-off-by: Dan Williams Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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 bb3e4b1cb77..11457a28a14 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2097,7 +2097,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.41.1