Re: [PATCH] nvme-fabrics: fix DHCHAP secret leak on parse failure

From: Keith Busch

Date: Wed Aug 19 2026 - 11:36:59 EST


On Thu, Aug 13, 2026 at 04:31:07PM +0800, raoxu wrote:
> From: Xu Rao <raoxu@xxxxxxxxxxxxx>
>
> nvmf_parse_options() duplicates dhchap_secret and dhchap_ctrl_secret
> with match_strdup() before validating the DHHC-1: representation.
>
> If validation fails, the parser returns -EINVAL before the temporary
> string in p is assigned to opts->dhchap_secret or
> opts->dhchap_ctrl_secret. nvmf_create_ctrl() subsequently frees opts,
> but nvmf_free_options() cannot release the unassigned temporary string.
> Each rejected option therefore leaks one allocation.

Thanks, applied to nvme-7.3.