Re: [PATCH] scsi: elx: libefc: fix resources leak in efcport_init() error path

From: Daniel Wagner

Date: Mon Oct 12 2026 - 05:36:55 EST


On Fri, Oct 09, 2026 at 02:54:03AM +0800, Haotian Zhang wrote:
> efcport_init() creates efc->node_pool and efc->node_dma_pool before
> allocating efc->els_io_pool. When the latter allocation fails it returns
> -ENOMEM without releasing the node dma pool or the node pool, leaking
> both. The caller efct_efclib_config() only logs the error and
> efct_device_attach() failure path never calls efcport_destroy(), so the
> resources are never freed.
>
> Destroy node_dma_pool and node_pool before returning from the
> els_io_pool allocation failure path.
>
> Fixes: d7b71fd2195e ("scsi: elx: libefc: Emulex FC discovery library APIs and definitions")
> Assisted-by: DeepSeek-V4.1-Flash
> Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>

Patch looks correct.

I didn't follow your other submission and this fix here is simple
enough, so I don't mind it.

Though, I see Krzysztof's response and thus you should not take my
Reviewed by tag here as free ticket to overload other maintainers.
Please follow our community guidelines.

Reviewed-by: Daniel Wagner <dwagner@xxxxxxx>