Skip to content

Commit 3409aed

Browse files
ocabragregkh
authored andcommitted
smb: client: fix query directory replay double-free
commit 9647492 upstream. A response-bearing attempt can return a replayable error and free its response buffer. If SMB2_query_directory_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 f08b3f4 commit 3409aed

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
@@ -5814,6 +5814,8 @@ SMB311_posix_qfs_info(const unsigned int xid, struct cifs_tcon *tcon,
58145814

58155815
replay_again:
58165816
/* reinitialize for possible replay */
5817+
resp_buftype = CIFS_NO_BUFFER;
5818+
memset(&rsp_iov, 0, sizeof(rsp_iov));
58175819
flags = 0;
58185820
server = cifs_pick_channel(ses);
58195821

0 commit comments

Comments
 (0)