Re: [PATCH] nvmet: prevent double-free after metadata SGL allocation failure

From: Keith Busch

Date: Thu Oct 22 2026 - 11:46:27 EST


On Thu, Oct 22, 2026 at 09:29:23AM +0300, Avi Weiss wrote:
> If metadata SGL allocation fails, nvmet_req_alloc_sgls() frees
> req->sg without clearing it. The RDMA error completion path later
> frees the same scatterlist again.
>
> Use nvmet_req_free_sgls() instead so that the scatterlist pointers
> and counts are cleared before response cleanup.

Looks good, applied to nvme-7.4.