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)
committerSteve French <stfrench@microsoft.com>
Wed, 25 Aug 2021 20:42:18 +0000 (15:42 -0500)
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>
fs/cifs/sess.c

index c5785fd..606fd7d 100644 (file)
@@ -877,7 +877,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;