]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: properly invalidate cached root handle when closing it
authorEnzo Matsumiya <ematsumiya@suse.de>
Thu, 9 Sep 2021 21:46:45 +0000 (18:46 -0300)
committerSteve French <stfrench@microsoft.com>
Thu, 9 Sep 2021 22:34:38 +0000 (17:34 -0500)
commit75895e4b659bde44b18fab05a87a915629cba0fb
treec6ef9ed51281ca9388482d589a448a83ac9c0810
parent7a0ef878dd0aca3a3ebbaa9f808a800e12e33565
cifs: properly invalidate cached root handle when closing it

Cached root file was not being completely invalidated sometimes.

Reproducing:
- With a DFS share with 2 targets, one disabled and one enabled
- start some I/O on the mount
  # while true; do ls /mnt/dfs; done
- at the same time, disable the enabled target and enable the disabled
  one
- wait for DFS cache to expire
- on reconnect, the previous cached root handle should be invalid, but
  open_cached_dir_by_dentry() will still try to use it, but throws a
  use-after-free warning (kref_get())

Make smb2_close_cached_fid() invalidate all fields every time, but only
send an SMB2_close() when the entry is still valid.

Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2ops.c