Re: blktests failures with v7.0-rc1 kernel

Yi Zhang
2026-03-11T15:09:21Z

On Wed, Mar 11, 2026 at 5:02 PM Maurizio Lombardi <mlombard@arkamax.eu> wrote:
>
> On Wed Mar 11, 2026 at 8:29 AM CET, Maurizio Lombardi wrote:
> > On Wed Mar 11, 2026 at 1:35 AM CET, Yi Zhang wrote:
> >
> > If nvmet_rdma_rw_ctx_init() fails, shouldn't it call
> > nvmet_req_free_sgls() before returning an error?
>
> Possible fix, not tested:
>
Hi Maurizio
The kmemleak still can be reproduced with this patch:

unreferenced object 0xffff88811db23d80 (size 32):
comm "kworker/16:1H", pid 1360, jiffies 4296118279
hex dump (first 32 bytes):
82 3b 85 04 00 ea ff ff 00 00 00 00 00 10 00 00 .;..............
00 e0 4e 21 81 88 ff ff 00 10 00 00 00 00 00 00 ..N!............
backtrace (crc 4bb38867):
__kmalloc_noprof+0x6f1/0xa10
sgl_alloc_order+0x9e/0x370
nvmet_req_alloc_sgls+0x294/0x4f0 [nvmet]
nvmet_rdma_map_sgl_keyed+0x25d/0x9a0 [nvmet_rdma]
nvmet_rdma_handle_command+0x1ed/0x4e0 [nvmet_rdma]
__ib_process_cq+0x139/0x4b0 [ib_core]
ib_cq_poll_work+0x4d/0x160 [ib_core]
process_one_work+0x8b1/0x15e0
worker_thread+0x5e9/0xfc0
kthread+0x36b/0x470
ret_from_fork+0x5bf/0x910
ret_from_fork_asm+0x1a/0x30

> diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
> index 2d6eb89f98af..79ae743bb405 100644
> --- a/drivers/nvme/target/rdma.c
> +++ b/drivers/nvme/target/rdma.c
> @@ -892,7 +892,7 @@ static u16 nvmet_rdma_map_sgl_keyed(struct nvmet_rdma_rsp *rsp,
>
> ret = nvmet_rdma_rw_ctx_init(rsp, addr, key, &sig_attrs);
> if (unlikely(ret < 0))
> - goto error_out;
> + goto error_free_sgl;
> rsp->n_rdma += ret;
>
> if (invalidate)
> @@ -900,6 +900,8 @@ static u16 nvmet_rdma_map_sgl_keyed(struct nvmet_rdma_rsp *rsp,
>
> return 0;
>
> +error_free_sgl:
> + nvmet_req_free_sgls(&rsp->req);
> error_out:
> rsp->req.transfer_len = 0;
> return NVME_SC_INTERNAL;
>
> Maurizio
>

--
Best Regards,
Yi Zhang