]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cifs: fix wrong release in sess_alloc_buffer() failed path
authorDing Hui <dinghui@sangfor.com.cn>
Tue, 17 Aug 2021 14:55:10 +0000 (22:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:35 +0000 (12:26 +0200)
[ Upstream commit d72c74197b70bc3c95152f351a568007bffa3e11 ]

smb_buf is allocated by small_smb_init_no_tc(), and buf type is
CIFS_SMALL_BUFFER, so we should use cifs_small_buf_release() to
release it in failed path.

Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/sess.c

index 85bd644f9773b7a44619d132c8d9a210178da9b0..30f841a880acd27d4198a9ab5aa197f2253b1b07 100644 (file)
@@ -610,7 +610,7 @@ sess_alloc_buffer(struct sess_data *sess_data, int wct)
        return 0;
 
 out_free_smb_buf:
-       kfree(smb_buf);
+       cifs_small_buf_release(smb_buf);
        sess_data->iov[0].iov_base = NULL;
        sess_data->iov[0].iov_len = 0;
        sess_data->buf0_type = CIFS_NO_BUFFER;