smb/server: fix refcount leak in parse_durable_handle_context()
authorZhangGuoDong <zhangguodong@kylinos.cn>
Mon, 29 Dec 2025 02:13:29 +0000 (10:13 +0800)
committerSteve French <stfrench@microsoft.com>
Mon, 29 Dec 2025 23:39:58 +0000 (17:39 -0600)
When the command is a replay operation and -ENOEXEC is returned,
the refcount of ksmbd_file must be released.

Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/smb2pdu.c

index 8a7c48a..ec9e4cd 100644 (file)
@@ -2812,6 +2812,7 @@ static int parse_durable_handle_context(struct ksmbd_work *work,
                                            SMB2_CLIENT_GUID_SIZE)) {
                                        if (!(req->hdr.Flags & SMB2_FLAGS_REPLAY_OPERATION)) {
                                                err = -ENOEXEC;
+                                               ksmbd_put_durable_fd(dh_info->fp);
                                                goto out;
                                        }