diff options
author | Konstantin Khlebnikov <khlebnikov@openvz.org> | 2012-12-14 15:03:10 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-17 08:46:46 -0800 |
commit | c08745c377c89ba6dde5c38eff96c5d7a710fd26 (patch) | |
tree | 97e65cee5eea7e769dfe783ac2691c7c0064fffd | |
parent | 633396662719397cbd7d4cb935807030d386f9de (diff) | |
download | lwn-c08745c377c89ba6dde5c38eff96c5d7a710fd26.tar.gz lwn-c08745c377c89ba6dde5c38eff96c5d7a710fd26.zip |
EDAC: Fix kernel panic on module unloading
commit 311bd84247ee0bedae6cdfbfc5e2c3450f9decd1 upstream.
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: 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>
[ a partial 3.7.y backport ]
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/edac/edac_mc_sysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index ed0bc07b8503..fe4fa1cde67e 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -1145,7 +1145,7 @@ int __init edac_mc_sysfs_init(void) void __exit edac_mc_sysfs_exit(void) { - put_device(mci_pdev); device_del(mci_pdev); + put_device(mci_pdev); edac_put_sysfs_subsys(); } |