]> www.infradead.org Git - users/dwmw2/linux.git/commit
SMB3: Fix potential memory leak when processing compound chain
authorPavel Shilovsky <pshilov@microsoft.com>
Mon, 22 Jul 2019 18:38:22 +0000 (11:38 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Aug 2019 06:30:14 +0000 (08:30 +0200)
commitefb86f76c6c846d20ebfa0b4c6c44bf8d0ce95b4
treeed4045f8e037e648c361c84b458004b75afed7b3
parent6dfb0916b1fd1a384b87576984091c5c8567dff2
SMB3: Fix potential memory leak when processing compound chain

[ Upstream commit 3edeb4a4146dc3b54d6fa71b7ee0585cb52ebfdf ]

When a reconnect happens in the middle of processing a compound chain
the code leaks a buffer from the memory pool. Fix this by properly
checking for a return code and freeing buffers in case of error.

Also maintain a buf variable to be equal to either smallbuf or bigbuf
depending on a response buffer size while parsing a chain and when
returning to the caller.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/smb2ops.c