]> www.infradead.org Git - users/hch/misc.git/commitdiff
smb/server: fix possible memory leak in smb2_read()
authorZhangGuoDong <zhangguodong@kylinos.cn>
Sat, 11 Oct 2025 16:47:59 +0000 (00:47 +0800)
committerSteve French <stfrench@microsoft.com>
Wed, 15 Oct 2025 11:03:09 +0000 (06:03 -0500)
Memory leak occurs when ksmbd_vfs_read() fails.
Fix this by adding the missing kvfree().

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

index ab1d45fcebdef1c805ce830e14c1de44b01c7098..e81e615f322afbcfb6e5e45f4e238226a5cab77a 100644 (file)
@@ -6824,6 +6824,7 @@ int smb2_read(struct ksmbd_work *work)
 
        nbytes = ksmbd_vfs_read(work, fp, length, &offset, aux_payload_buf);
        if (nbytes < 0) {
+               kvfree(aux_payload_buf);
                err = nbytes;
                goto out;
        }