diff options
author | Maxim Levitsky <maximlevitsky@gmail.com> | 2010-07-28 17:53:16 +0200 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-08-06 10:20:47 +0200 |
commit | dba76c033f1b88b6eb0fa697b824f954b11f8a97 (patch) | |
tree | 2417e535c570a84efb4073efa3712fa4d99e81f5 | |
parent | mtd: denali: update get nand para functions (diff) | |
download | linux-dba76c033f1b88b6eb0fa697b824f954b11f8a97.tar.xz linux-dba76c033f1b88b6eb0fa697b824f954b11f8a97.zip |
mtd: blkdevs: fix crash related to sysfs attributes.
Remove the attributes group before disk to avoid use after free
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | drivers/mtd/mtd_blkdevs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index a6bb5863e8f3..89e07e5af577 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -410,13 +410,14 @@ int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old) BUG(); } - /* Stop new requests to arrive */ - del_gendisk(old->disk); - if (old->disk_attributes) sysfs_remove_group(&disk_to_dev(old->disk)->kobj, old->disk_attributes); + /* Stop new requests to arrive */ + del_gendisk(old->disk); + + /* Stop the thread */ kthread_stop(old->thread); |