lib/test_kmod.c: fix rmmod double free
authorLuis Chamberlain <[email protected]>
Fri, 30 Nov 2018 22:09:21 +0000 (14:09 -0800)
committerLinus Torvalds <[email protected]>
Fri, 30 Nov 2018 22:56:14 +0000 (14:56 -0800)
We free the misc device string twice on rmmod; fix this.  Without this
we cannot remove the module without crashing.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Luis Chamberlain <[email protected]>
Reported-by: Randy Dunlap <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: <[email protected]> [4.12+]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
lib/test_kmod.c

index e3ddd836491faef2a21c1b1218d4fd1c4b219f0f..d82d022111e0e5321ef17cff105e1e87bc90ba0e 100644 (file)
@@ -1214,7 +1214,6 @@ void unregister_test_dev_kmod(struct kmod_test_device *test_dev)
 
        dev_info(test_dev->dev, "removing interface\n");
        misc_deregister(&test_dev->misc_dev);
-       kfree(&test_dev->misc_dev.name);
 
        mutex_unlock(&test_dev->config_mutex);
        mutex_unlock(&test_dev->trigger_mutex);