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

Keith Busch kbusch at kernel.org
Wed Aug 19 08:34:03 PDT 2026


On Thu, Aug 13, 2026 at 04:31:07PM +0800, raoxu wrote:
> From: Xu Rao <raoxu at uniontech.com>
> 
> 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.



More information about the Linux-nvme mailing list