1
0
Fork 0
alistair23-linux/drivers/dax
Wang Hai b16a6a46e0 device-dax/core: Fix memory leak when rmmod dax.ko
commit 1aa5743125 upstream.

When I repeatedly modprobe and rmmod dax.ko, kmemleak report a
memory leak as follows:

unreferenced object 0xffff9a5588c05088 (size 8):
  comm "modprobe", pid 261, jiffies 4294693644 (age 42.063s)
...
  backtrace:
    [<00000000e007ced0>] kstrdup+0x35/0x70
    [<000000002ae73897>] kstrdup_const+0x3d/0x50
    [<000000002b00c9c3>] kvasprintf_const+0xbc/0xf0
    [<000000008023282f>] kobject_set_name_vargs+0x3b/0xd0
    [<00000000d2cbaa4e>] kobject_set_name+0x62/0x90
    [<00000000202e7a22>] bus_register+0x7f/0x2b0
    [<000000000b77792c>] 0xffffffffc02840f7
    [<000000002d5be5ac>] 0xffffffffc02840b4
    [<00000000dcafb7cd>] do_one_initcall+0x58/0x240
    [<00000000049fe480>] do_init_module+0x56/0x1e2
    [<0000000022671491>] load_module+0x2517/0x2840
    [<000000001a2201cb>] __do_sys_finit_module+0x9c/0xe0
    [<000000003eb304e7>] do_syscall_64+0x33/0x40
    [<0000000051c5fd06>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

When rmmod dax is executed, dax_bus_exit() is missing. This patch
can fix this bug.

Fixes: 9567da0b40 ("device-dax: Introduce bus + driver model")
Cc: <stable@vger.kernel.org>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Link: https://lore.kernel.org/r/20201201135929.66530-1-wanghai38@huawei.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-30 11:51:46 +01:00
..
pmem memremap: move dev_pagemap callbacks into a separate structure 2019-07-02 14:32:44 -03:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile device-dax: "Hotplug" persistent memory for use like normal RAM 2019-02-28 10:41:23 -08:00
bus.c dax: Fix alloc_dax_region() compile warning 2020-10-01 13:17:15 +02:00
bus.h dax: Fix alloc_dax_region() compile warning 2020-10-01 13:17:15 +02:00
dax-private.h dax: Fix alloc_dax_region() compile warning 2020-10-01 13:17:15 +02:00
device.c device-dax: use the dev_pagemap internal refcount 2019-07-02 14:32:44 -03:00
kmem.c device-dax: don't leak kernel memory to user space after unloading kmem 2020-05-27 17:46:48 +02:00
super.c device-dax/core: Fix memory leak when rmmod dax.ko 2020-12-30 11:51:46 +01:00