diff options
| author | Henry Martin <bsdhenrymartin@gmail.com> | 2026-10-10 11:28:56 +0800 |
|---|---|---|
| committer | Paulo Alcantara <pc@manguebit.org> | 2026-10-13 00:52:20 -0300 |
| commit | 031278577380e7875d95aed81a2b2bcac39be923 (patch) | |
| tree | 3783cecbd0cbe323572c8e43f3209ae488db477d /tools/perf/scripts/python/stackcollapse.py | |
| parent | 80f49404968d680f07f33f57ed9a9a1ddd2f2418 (diff) | |
| download | linux-031278577380e7875d95aed81a2b2bcac39be923.tar.gz linux-031278577380e7875d95aed81a2b2bcac39be923.zip | |
smb: client: fix use-after-free in cifs_ses_add_channel()
The error path of cifs_ses_add_channel() calls cifs_put_tcp_session()
before cifs_chan_clear_need_reconnect(). The latter reaches
cifs_ses_get_chan_index(), which dereferences server->terminate; if
the put was the final reference, TCP_Server_Info is already freed and
this is a use-after-free. Same put-then-use pattern as the recently
fixed sibling in commit 717e0a25036b ("cifs: Fix server use-after-free
in cifs_chan_skip_or_disable()").
Move the put last, but do not read chan->server after dropping
chan_lock: chan points into ses->chans[], and once chan_count is
decremented a concurrent add_channel can reuse the slot and overwrite
the pointer, so the put would act on the new channel's server. Cache
the pointer under chan_lock, clear the reconnect bit and decrement
chan_count while still holding the reference, and release it after
the unlock.
This issue was discovered by Tencent CodeBuddy Security.
Fixes: ee1d21794e55a ("cifs: handle when server stops supporting multichannel")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Cc: stable@vger.kernel.org
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
