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)
committerSteve French <stfrench@microsoft.com>
Tue, 6 Aug 2019 03:50:13 +0000 (22:50 -0500)
commit3edeb4a4146dc3b54d6fa71b7ee0585cb52ebfdf
tree6c4487f7274644d38f128e31e37bba38f9880085
parente99c63e4d86d3a94818693147b469fa70de6f945
SMB3: Fix potential memory leak when processing compound chain

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>
fs/cifs/smb2ops.c