From: Ding Hui Date: Tue, 17 Aug 2021 14:55:10 +0000 (+0800) Subject: cifs: fix wrong release in sess_alloc_buffer() failed path X-Git-Tag: v5.13.19~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e167075a97d4c14672a763ad3e24da9b9255a5e;p=thirdparty%2Fkernel%2Fstable.git cifs: fix wrong release in sess_alloc_buffer() failed path [ 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 Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Sasha Levin --- diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index a92a1fb7cb526..4c22f73b31232 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -889,7 +889,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;