mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
smb: client: fix double-free in SMB2_flush() replay
SMB2_flush() keeps its response buffer bookkeeping across replay
attempts. If a replayable flush response is received and the retry then
fails before cifs_send_recv() stores a replacement response, flush_exit
will free the stale response pointer a second time.
Reinitialize resp_buftype and rsp_iov at the top of the replay loop so
cleanup only acts on response state produced by the current attempt.
This fixes a double-free without changing replay handling for successful
requests.
Fixes: 4f1fffa237 ("cifs: commands that are retried should have replay flag set")
Cc: stable@vger.kernel.org
Reported-by: Yuan Tan <yuantan098@gmail.com>
Reported-by: Zhengchuan Liang <zcliangcn@gmail.com>
Reported-by: Xin Liu <bird@lzu.edu.cn>
Assisted-by: Codex:GPT-5.4
Acked-by: Henrique Carvalho <henrique.carvalho@suse.com>
Signed-off-by: Zhao Zhang <zzhan461@ucr.edu>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
dac3b26eae
commit
4be31c943a
|
|
@ -4450,6 +4450,8 @@ SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
|
|||
|
||||
replay_again:
|
||||
/* reinitialize for possible replay */
|
||||
resp_buftype = CIFS_NO_BUFFER;
|
||||
memset(&rsp_iov, 0, sizeof(rsp_iov));
|
||||
flags = 0;
|
||||
server = cifs_pick_channel(ses);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user