nvmet: Fix a memory leak
Subsystems (2)
Sagi Grimberg
maintainerPATCH 1/1 nvmet: Fix a memory leak
We need to also free the dhchap_ctrl_secret when releasing nvmet_host. kmemleak complaint:
--
unreferenced object 0xffff99b1cbca5140 (size 64):
comm "check", pid 4864, jiffies 4305092436 (age 2913.583s) hex dump (first 32 bytes):
44 48 48 43 2d 31 3a 30 30 3a 65 36 2b 41 63 44 DHHC-1:00:e6+AcD
39 76 47 4d 52 57 59 78 67 54 47 44 51 59 47 78 9vGMRWYxgTGDQYGx
backtrace:
[<00000000c07d369d>] kstrdup+0x2e/0x60
[<000000001372171c>] 0xffffffffc0cceec6
[<0000000010dbf50b>] 0xffffffffc0cc6783
[<000000007465e93c>] configfs_write_iter+0xb1/0x120
[<0000000039c23f62>] vfs_write+0x2be/0x3c0
[<000000002da4351c>] ksys_write+0x5f/0xe0
[<00000000d5011e32>] do_syscall_64+0x38/0x90
[<00000000503870cf>] entry_SYSCALL_64_after_hwframe+0x63/0xcdFixes db1312dd9548 ("nvmet: implement basic In-Band Authentication")
Signed-off-by Sagi Grimberg <[email protected]>
--- drivers/nvme/target/configfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/target/configfs.c +1 -0
@@ -1836,6 +1836,7 @@ static void nvmet_host_release(struct config_item *item)#ifdef CONFIG_NVME_TARGET_AUTH kfree (host->dhchap_secret); +kfree (host->dhchap_ctrl_secret);#endif kfree (host); }
Signature · 1 line
2.34.1
Quoted 18 lines · Sagi Grimberg
We need to also free the
dhchap_ctrl_secretwhen releasingnvmet_host. kmemleak complaint:
--
unreferenced object0xffff99b1cbca5140(size 64):comm "check", pid 4864, jiffies 4305092436 (age 2913.583s) hex dump (first 32 bytes): 44 48 48 43 2d 31 3a 30 30 3a 65 36 2b 41 63 44 DHHC-1:00:e6+AcD 39 76 47 4d 52 57 59 78 67 54 47 44 51 59 47 78 9vGMRWYxgTGDQYGx backtrace: [<00000000c07d369d>] kstrdup+0x2e/0x60 [<000000001372171c>] 0xffffffffc0cceec6 [<0000000010dbf50b>] 0xffffffffc0cc6783 [<000000007465e93c>] configfs_write_iter+0xb1/0x120 [<0000000039c23f62>] vfs_write+0x2be/0x3c0 [<000000002da4351c>] ksys_write+0x5f/0xe0 [<00000000d5011e32>] do_syscall_64+0x38/0x90 [<00000000503870cf>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
Quoted 3 lines
Fixes db1312dd9548 ("nvmet: implement basic In-Band Authentication")Signed-off-by Sagi Grimberg <[email protected]>---
Reviewed-by Chaitanya Kulkarni <[email protected]>
-ck