Skip to content

Commit 14498ff

Browse files
ocabragregkh
authored andcommitted
smb: client: fix double-free in SMB2_open() replay
commit b55e182 upstream. A response-bearing attempt can return a replayable error and free its response buffer. If SMB2_open_init() fails before the next send, cleanup retains the previous buffer type and frees that response again. Reset response bookkeeping before each attempt to prevent the stale free. Fixes: 4f1fffa ("cifs: commands that are retried should have replay flag set") Cc: stable@vger.kernel.org Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3407240 commit 14498ff

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/smb/client/smb2pdu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,6 +3205,8 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
32053205

32063206
replay_again:
32073207
/* reinitialize for possible replay */
3208+
resp_buftype = CIFS_NO_BUFFER;
3209+
memset(&rsp_iov, 0, sizeof(rsp_iov));
32083210
flags = 0;
32093211
server = cifs_pick_channel(ses);
32103212
oparms->replay = !!(retries);

0 commit comments

Comments
 (0)