cifs: fix potential use-after-free bugs
authorPaulo Alcantara <pc@cjr.nz>
Fri, 12 Nov 2021 18:16:08 +0000 (15:16 -0300)
committerSteve French <stfrench@microsoft.com>
Fri, 12 Nov 2021 18:59:59 +0000 (12:59 -0600)
commit7f28af9cf542f61758b982f8304f951ca99c8f58
tree58dc163d9de07ac2cb55e5ca2c7928c7daf215a9
parent869da64d071142d4ed562a3e909deb18e4e72c4e
cifs: fix potential use-after-free bugs

Ensure that share and prefix variables are set to NULL after kfree()
when looping through DFS targets in __tree_connect_dfs_target().

Also, get rid of @ref in __tree_connect_dfs_target() and just pass a
boolean to indicate whether we're handling link targets or not.

Fixes: c88f7dcd6d64 ("cifs: support nested dfs links over reconnect")
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/connect.c