Skip to content

Commit

Permalink
cifs: fix wrong release in sess_alloc_buffer() failed path
Browse files Browse the repository at this point in the history
[ Upstream commit d72c741 ]

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>
  • Loading branch information
cdkey authored and gregkh committed Sep 18, 2021
1 parent 706060c commit 6ac2dc8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/cifs/sess.c
Expand Up @@ -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;
Expand Down

0 comments on commit 6ac2dc8

Please sign in to comment.