[PATCH 6.1.y] smb: prevent use-after-free due to open_cached_dir error paths