cifs: fix potential use-after-free bugs in TCP_Server_Info::hostname
authorPaulo Alcantara <pc@manguebit.com>
Fri, 21 Apr 2023 18:52:32 +0000 (15:52 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:41 +0000 (23:03 +0900)
commit64d62ac6d6514cba1305bd08e271ec1843bdd612
tree864df9015430f429683214399c5726f9e6a8cce4
parenta744060574889927f2c22a0562d69aa820e3c9e1
cifs: fix potential use-after-free bugs in TCP_Server_Info::hostname

commit 90c49fce1c43e1cc152695e20363ff5087897c09 upstream.

TCP_Server_Info::hostname may be updated once or many times during
reconnect, so protect its access outside reconnect path as well and
then prevent any potential use-after-free bugs.

Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/cifs_debug.c
fs/cifs/cifs_debug.h
fs/cifs/connect.c
fs/cifs/sess.c