[PATCH v2] nvme: fix memleak in nvme_ctrl_dhchap_secret_store()

Chaitanya Kulkarni chaitanyak at nvidia.com
Mon Nov 28 20:29:52 PST 2022


On 11/21/22 20:49, Zhang Qilong wrote:
> If dhchap_secret is not consistent with options or
> nvme_auth_generate_key() fails, we should free the
> memory of dhchap_secret to avoid memleak.
> 
> We fix it by changing the check strcmp to strncmp
> directly against buf and moving allocating inside
> to the clause.
> 
> Fixes: f50fff73d620 ("nvme: implement In-Band authentication")
> Signed-off-by: Zhang Qilong <zhangqilong3 at huawei.com>
> ---
> v2:
> - changing checking function and allocating location.
> ---
>
Looks good.

Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>

-ck



More information about the Linux-nvme mailing list