linux/fs/smb/client
Shyam Prasad N 5eef12c4e3 cifs: fix lock ordering while disabling multichannel
The code to handle the case of server disabling multichannel
was picking iface_lock with chan_lock held. This goes against
the lock ordering rules, as iface_lock is a higher order lock
(even if it isn't so obvious).

This change fixes the lock ordering by doing the following in
that order for each secondary channel:
1. store iface and server pointers in local variable
2. remove references to iface and server in channels
3. unlock chan_lock
4. lock iface_lock
5. dec ref count for iface
6. unlock iface_lock
7. dec ref count for server
8. lock chan_lock again

Since this function can only be called in smb2_reconnect, and
that cannot be called by two parallel processes, we should not
have races due to dropping chan_lock between steps 3 and 8.

Fixes: ee1d21794e ("cifs: handle when server stops supporting multichannel")
Reported-by: Paulo Alcantara <pc@manguebit.com>
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2023-11-14 11:39:35 -06:00
..
asn1.c
cached_dir.c smb: client: fix use-after-free in smb2_query_info_compound() 2023-11-02 08:06:06 -05:00
cached_dir.h smb: client: make laundromat a delayed worker 2023-10-12 09:41:04 -05:00
cifs_debug.c cifs: distribute channels across interfaces based on speed 2023-11-09 10:25:17 -06:00
cifs_debug.h
cifs_fs_sb.h
cifs_ioctl.h smb3: allow dumping session and tcon id to improve stats analysis and debugging 2023-11-10 02:00:30 -06:00
cifs_spnego_negtokeninit.asn1
cifs_spnego.c cifs: spnego: add ';' in HOST_KEY_LEN 2023-11-13 16:21:34 -06:00
cifs_spnego.h
cifs_swn.c
cifs_swn.h
cifs_unicode.c fs/smb/client: Use common code in client 2023-08-30 08:55:52 -05:00
cifs_unicode.h fs/smb/client: Use common code in client 2023-08-30 08:55:52 -05:00
cifsacl.c
cifsacl.h
cifsencrypt.c
cifsfs.c smb3: fix touch -h of symlink 2023-10-22 19:03:41 -05:00
cifsfs.h cifs: update internal module version number for cifs.ko 2023-11-10 09:33:26 -06:00
cifsglob.h cifs: handle when server stops supporting multichannel 2023-11-10 09:33:19 -06:00
cifspdu.h smb3: fix creating FIFOs when mounting with "sfu" mount option 2023-10-31 12:23:11 -05:00
cifsproto.h cifs: handle when server stops supporting multichannel 2023-11-10 09:33:19 -06:00
cifsroot.c
cifssmb.c cifs: fix charset issue in reconnection 2023-07-25 00:31:24 -05:00
connect.c cifs: fix leak of iface for primary channel 2023-11-14 11:38:00 -06:00
dfs_cache.c smb: client: ensure to try all targets when finding nested links 2023-08-20 16:05:50 -05:00
dfs_cache.h smb: client: ensure to try all targets when finding nested links 2023-08-20 16:05:50 -05:00
dfs.c smb: client: fix mount when dns_resolver key is not available 2023-11-09 12:59:36 -06:00
dfs.h smb: client: get rid of dfs code dep in namespace.c 2023-08-20 16:05:50 -05:00
dir.c smb: client: get rid of dfs naming in automount code 2023-08-20 16:05:50 -05:00
dns_resolve.c
dns_resolve.h
export.c exportfs: make ->encode_fh() a mandatory method for NFS export 2023-10-28 16:15:15 +02:00
file.c client: convert to new timestamp accessors 2023-10-18 14:08:27 +02:00
fs_context.c fs/smb/client: Reset password pointer to NULL 2023-09-28 14:49:51 -05:00
fs_context.h smb: client: fix mount when dns_resolver key is not available 2023-11-09 12:59:36 -06:00
fscache.c smb: propagate error code of extract_sharename() 2023-08-30 23:38:49 -05:00
fscache.h client: convert to new timestamp accessors 2023-10-18 14:08:27 +02:00
inode.c 15 cifs client fixes 2023-11-04 09:13:50 -10:00
ioctl.c Missing field not being returned in ioctl CIFS_IOC_GET_MNT_INFO 2023-11-10 09:32:04 -06:00
Kconfig fs/smb/client: Use common code in client 2023-08-30 08:55:52 -05:00
link.c smb: use crypto_shash_digest() in symlink_hash() 2023-10-31 12:38:26 -05:00
Makefile smb: client: get rid of dfs code dep in namespace.c 2023-08-20 16:05:50 -05:00
misc.c smb3: do not start laundromat thread when dir leases 2023-09-19 13:32:02 -05:00
namespace.c smb: client: fix mount when dns_resolver key is not available 2023-11-09 12:59:36 -06:00
netlink.c
netlink.h
netmisc.c
nterr.c
nterr.h
ntlmssp.h cifs: Add client version details to NTLM authenticate message 2023-10-22 19:03:42 -05:00
readdir.c smb: cilent: set reparse mount points as automounts 2023-08-20 16:05:50 -05:00
rfc1002pdu.h
sess.c cifs: fix lock ordering while disabling multichannel 2023-11-14 11:39:35 -06:00
smb1ops.c smb: client: do not query reparse points twice on symlinks 2023-08-20 16:05:50 -05:00
smb2file.c
smb2glob.h
smb2inode.c smb: client: handle STATUS_IO_REPARSE_TAG_NOT_HANDLED 2023-09-20 16:12:09 -05:00
smb2maperror.c smb3: remove duplicate error mapping 2023-09-20 16:04:51 -05:00
smb2misc.c smb: client: fix potential deadlock when releasing mids 2023-10-31 12:38:02 -05:00
smb2ops.c cifs: account for primary channel in the interface list 2023-11-09 10:25:19 -06:00
smb2pdu.c cifs: handle when server stops supporting multichannel 2023-11-10 09:33:19 -06:00
smb2pdu.h
smb2proto.h smb: client: move some params to cifs_open_info_data 2023-08-20 16:05:50 -05:00
smb2status.h
smb2transport.c cifs: fix check of rc in function generate_smb3signingkey 2023-11-13 16:22:30 -06:00
smbdirect.c smb3: Add dynamic trace points for RDMA (smbdirect) reconnect 2023-09-19 11:03:24 -05:00
smbdirect.h
smbencrypt.c
smberr.h
trace.c
trace.h smb3: Add dynamic trace points for RDMA (smbdirect) reconnect 2023-09-19 11:03:24 -05:00
transport.c cifs: handle when server stops supporting multichannel 2023-11-10 09:33:19 -06:00
unc.c
winucase.c
xattr.c smb3: fix caching of ctime on setxattr 2023-11-09 10:25:58 -06:00