Re: [PATCH] smb/server: Fix another refcount leak in smb2_open()
From: Namjae Jeon
Date: Fri Feb 27 2026 - 01:04:53 EST
On Fri, Feb 27, 2026 at 2:54 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
>
> If ksmbd_override_fsids() fails, we jump to err_out2. At that point, fp is
> NULL because it hasn't been assigned dh_info.fp yet, so ksmbd_fd_put(work,
> fp) will not be called. However, dh_info.fp was already inserted into the
> session file table by ksmbd_reopen_durable_fd(), so it will leak in the
> session file table until the session is closed.
>
> Move fp = dh_info.fp; ahead of the ksmbd_override_fsids() check to fix the
> problem.
>
> Found by an experimental AI code review agent at Google.
>
> Cc: Namjae Jeon <linkinjeon@xxxxxxxxxx>
> Cc: ChenXiaoSong <chenxiaosong@xxxxxxxxxxxxxxxx>
> Fixes: c8efcc786146a ("ksmbd: add support for durable handles v1/v2")
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
Applied it with ChenXiaoSong's reviewed-by tag to #ksmbd-for-next-next.
Thanks!