* [PATCH] scsi: scsi_debug: fix a memory leak.
@ 2021-02-08 11:17 Maurizio Lombardi
2021-02-08 17:38 ` Douglas Gilbert
2021-02-09 3:43 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Maurizio Lombardi @ 2021-02-08 11:17 UTC (permalink / raw)
To: jejb; +Cc: martin.petersen, linux-scsi, dgilbert
The sdebug_q_arr pointer must be freed when the module is unloaded
# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff888e1cfb0000 (size 4096):
comm "modprobe", pid 165555, jiffies 4325987516 (age 685.194s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000458f4f5d>] 0xffffffffc06702d9
[<000000003edc4b1f>] do_one_initcall+0xe9/0x57d
[<00000000da7d518c>] do_init_module+0x1d1/0x6f0
[<000000009a6a9248>] load_module+0x36bd/0x4f50
[<00000000ddb0c3ce>] __do_sys_init_module+0x1db/0x260
[<000000009532db57>] do_syscall_64+0xa5/0x420
[<000000002916b13d>] entry_SYSCALL_64_after_hwframe+0x6a/0xdf
Fixes: 87c715dcde633f4cc4690a24a240e838181e6a9d
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
drivers/scsi/scsi_debug.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 4a08c450b756..b6540b92f566 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -6881,6 +6881,7 @@ static void __exit scsi_debug_exit(void)
sdebug_erase_all_stores(false);
xa_destroy(per_store_ap);
+ kfree(sdebug_q_arr);
}
device_initcall(scsi_debug_init);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: scsi_debug: fix a memory leak.
2021-02-08 11:17 [PATCH] scsi: scsi_debug: fix a memory leak Maurizio Lombardi
@ 2021-02-08 17:38 ` Douglas Gilbert
2021-02-09 3:43 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Douglas Gilbert @ 2021-02-08 17:38 UTC (permalink / raw)
To: Maurizio Lombardi, jejb; +Cc: martin.petersen, linux-scsi
On 2021-02-08 6:17 a.m., Maurizio Lombardi wrote:
> The sdebug_q_arr pointer must be freed when the module is unloaded
>
> # cat /sys/kernel/debug/kmemleak
> unreferenced object 0xffff888e1cfb0000 (size 4096):
> comm "modprobe", pid 165555, jiffies 4325987516 (age 685.194s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<00000000458f4f5d>] 0xffffffffc06702d9
> [<000000003edc4b1f>] do_one_initcall+0xe9/0x57d
> [<00000000da7d518c>] do_init_module+0x1d1/0x6f0
> [<000000009a6a9248>] load_module+0x36bd/0x4f50
> [<00000000ddb0c3ce>] __do_sys_init_module+0x1db/0x260
> [<000000009532db57>] do_syscall_64+0xa5/0x420
> [<000000002916b13d>] entry_SYSCALL_64_after_hwframe+0x6a/0xdf
>
> Fixes: 87c715dcde633f4cc4690a24a240e838181e6a9d
>
> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Thanks.
> ---
> drivers/scsi/scsi_debug.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 4a08c450b756..b6540b92f566 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -6881,6 +6881,7 @@ static void __exit scsi_debug_exit(void)
>
> sdebug_erase_all_stores(false);
> xa_destroy(per_store_ap);
> + kfree(sdebug_q_arr);
> }
>
> device_initcall(scsi_debug_init);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: scsi_debug: fix a memory leak.
2021-02-08 11:17 [PATCH] scsi: scsi_debug: fix a memory leak Maurizio Lombardi
2021-02-08 17:38 ` Douglas Gilbert
@ 2021-02-09 3:43 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-02-09 3:43 UTC (permalink / raw)
To: Maurizio Lombardi, jejb; +Cc: Martin K . Petersen, dgilbert, linux-scsi
On Mon, 8 Feb 2021 12:17:34 +0100, Maurizio Lombardi wrote:
> The sdebug_q_arr pointer must be freed when the module is unloaded
>
> # cat /sys/kernel/debug/kmemleak
> unreferenced object 0xffff888e1cfb0000 (size 4096):
> comm "modprobe", pid 165555, jiffies 4325987516 (age 685.194s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<00000000458f4f5d>] 0xffffffffc06702d9
> [<000000003edc4b1f>] do_one_initcall+0xe9/0x57d
> [<00000000da7d518c>] do_init_module+0x1d1/0x6f0
> [<000000009a6a9248>] load_module+0x36bd/0x4f50
> [<00000000ddb0c3ce>] __do_sys_init_module+0x1db/0x260
> [<000000009532db57>] do_syscall_64+0xa5/0x420
> [<000000002916b13d>] entry_SYSCALL_64_after_hwframe+0x6a/0xdf
>
> [...]
Applied to 5.11/scsi-fixes, thanks!
[1/1] scsi: scsi_debug: fix a memory leak.
https://git.kernel.org/mkp/scsi/c/f852c596f2ee
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-09 3:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 11:17 [PATCH] scsi: scsi_debug: fix a memory leak Maurizio Lombardi
2021-02-08 17:38 ` Douglas Gilbert
2021-02-09 3:43 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.