2023-12-02 03:54:42

by Namjae Jeon

[permalink] [raw]
Subject: Re: [PATCH -next] ksmbd: fix memory leak in smb2_lock()

2023-12-01 23:50 GMT+09:00, Zizhi Wo <[email protected]>:
> In smb2_lock(), if setup_async_work() executes successfully,
> work->cancel_argv will bind the argv that generated by kmalloc(). And
> release_async_work() is called in ksmbd_conn_try_dequeue_request() or
> smb2_lock() to release argv.
> However, when setup_async_work function fails, work->cancel_argv has not
> been bound to the argv, resulting in the previously allocated argv not
> being released. Call kfree() to fix it.
>
> when setup_async_work fails, the code will go to the
> "out" branch, resulting in the previously allocated "argv" not being
> released. Call kfree() to fix it.
>
> Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
> Signed-off-by: Zizhi Wo <[email protected]>
Acked-by: Namjae Jeon <[email protected]>

Applied it to #ksmbd-for-next-next .
Thanks.