Skip to content

Commit

Permalink
mtd: blkdevs: fix crash related to sysfs attributes.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Maxim Levitsky authored and David Woodhouse committed Aug 6, 2010
1 parent ef41e1b commit dba76c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/mtd/mtd_blkdevs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit dba76c0

Please sign in to comment.