]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amdkfd: fix amdkfd use-after-free GP fault
authorRandy Dunlap <rdunlap@infradead.org>
Mon, 13 Nov 2017 16:08:48 +0000 (18:08 +0200)
committerOded Gabbay <oded.gabbay@gmail.com>
Sun, 26 Nov 2017 09:31:32 +0000 (11:31 +0200)
Fix GP fault caused by dev_info() reference to a struct device*
after the device has been freed (use after free).
kfd_chardev_exit() frees the device so 'kfd_device' should not
be used after calling kfd_chardev_exit().

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdkfd/kfd_module.c

index 6c5a9cab55ded2448f99ae9c2ec1c59bbd68a3e7..f744caeaee049587520c75524f3ee6e580b8a63e 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/sched.h>
 #include <linux/moduleparam.h>
 #include <linux/device.h>
+#include <linux/printk.h>
 #include "kfd_priv.h"
 
 #define KFD_DRIVER_AUTHOR      "AMD Inc. and others"
@@ -132,7 +133,7 @@ static void __exit kfd_module_exit(void)
        kfd_process_destroy_wq();
        kfd_topology_shutdown();
        kfd_chardev_exit();
-       dev_info(kfd_device, "Removed module\n");
+       pr_info("amdkfd: Removed module\n");
 }
 
 module_init(kfd_module_init);