Skip to content

Commit 311bd84

Browse files
koct9iBorislav Petkov
authored andcommitted
EDAC: Fix kernel panic on module unloading
This patch fixes use-after-free and double-free bugs in edac_mc_sysfs_exit(). mci_pdev has single reference and put_device() calls mc_attr_release() which calls kfree(). The following device_del() works with already released memory. An another kfree() in edac_mc_sysfs_exit() releses the same memory again. Great. Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: stable@vger.kernel.org # 3.[67] Cc: Denis Kirjanov <kirjanov@gmail.com> Cc: Mauro Carvalho Chehab <mchehab@redhat.com> Link: http://lkml.kernel.org/r/20121214110310.11019.21098.stgit@zurg Signed-off-by: Borislav Petkov <bp@alien8.de>
1 parent d1c3ed6 commit 311bd84

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/edac/edac_mc_sysfs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,8 +1159,7 @@ int __init edac_mc_sysfs_init(void)
11591159

11601160
void __exit edac_mc_sysfs_exit(void)
11611161
{
1162-
put_device(mci_pdev);
11631162
device_del(mci_pdev);
1163+
put_device(mci_pdev);
11641164
edac_put_sysfs_subsys();
1165-
kfree(mci_pdev);
11661165
}

0 commit comments

Comments
 (0)