[PATCH] nvme: Fix memory leak in nvme_init_ctrl error path

Chaitanya Kulkarni chaitanyak at nvidia.com
Thu May 4 18:17:55 PDT 2023


On 5/4/23 01:18, Sagi Grimberg wrote:
>
>> I try to apply this patch on linux-nvme nvme-6.4 it is not applying,
>> which tree I should use for this to test it ?
>>
>> nvme (nvme-6.4) # git apply init-ctrl-fix.patch
>> error: patch failed: drivers/nvme/host/core.c:5137
>> error: drivers/nvme/host/core.c: patch does not apply
>
> It is on top of your series for the other memleaks

With this applied on the top of [1] on linux-nvme:nvme-6.4,
blktests nvme/044 and nvme/045 are passing without producing
kmemleak [2].

without this patch I'm still getting :-

   backtrace:
     [<0000000003b3ab89>] kmalloc_trace+0x25/0x90
     [<00000000ee6a62bc>] device_add+0x4cf/0x850
     [<000000006959d6db>] cdev_device_add+0x44/0x90
     [<00000000a9254393>] nvme_init_ctrl+0x352/0x410 [nvme_core]
     [<00000000a8a801a7>] 0xffffffffc05158b3
     [<00000000a566bd92>] 0xffffffffc03734cb
     [<000000001b88fc1d>] vfs_write+0xc5/0x3c0
     [<0000000021d472df>] ksys_write+0x5f/0xe0
     [<0000000001cad18e>] do_syscall_64+0x3b/0x90
     [<000000001fc6210f>] entry_SYSCALL_64_after_hwframe+0x72/0xdc


Feel free to add :-
Tested-by: Chaitanya Kulkarni <kch at nvidia.com>

-ck

[1] http://lists.infradead.org/pipermail/linux-nvme/2023-April/039496.html




More information about the Linux-nvme mailing list