Skip to content

Commit f1add4a

Browse files
ocabragregkh
authored andcommitted
smb: client: fix query_info() replay double-free
commit 2a88561 upstream. A response-bearing attempt can return a replayable error and free its response buffer. If SMB2_query_info_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 00b0fa4 commit f1add4a

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
@@ -3821,6 +3821,8 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,
38213821

38223822
replay_again:
38233823
/* reinitialize for possible replay */
3824+
resp_buftype = CIFS_NO_BUFFER;
3825+
memset(&rsp_iov, 0, sizeof(rsp_iov));
38243826
flags = 0;
38253827
allocated = false;
38263828
server = cifs_pick_channel(ses);

0 commit comments

Comments
 (0)