Re: [PATCH] smb: client: unlock reconnect_mutex before putting session on terminate
From: Paulo Alcantara
Date: Thu Nov 26 2026 - 07:17:05 EST
Elkin Cruz <elkin@xxxxxxxxxx> writes:
> In smb2_reconnect_server(), when server->terminate is set, the early
> exit path calls cifs_put_tcp_session(server, true) while still holding
> pserver->reconnect_mutex and unlocks pserver->reconnect_mutex
> afterwards. Dropping the last session reference can free server (which
> equals pserver for primary channels), causing mutex_unlock() to touch
> freed memory; the normal done: label at the end of the same function
> explicitly unlocks reconnect_mutex before calling cifs_put_tcp_session().
>
> Unlock pserver->reconnect_mutex before calling cifs_put_tcp_session() in
> the server->terminate branch as well.
> ...
Applied.