aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/unix_bpf.c
diff options
context:
space:
mode:
authorShyam Prasad N <[email protected]>2023-11-14 04:58:23 +0000
committerSteve French <[email protected]>2023-11-14 17:39:35 +0000
commit5eef12c4e3230f2025dc46ad8c4a3bc19978e5d7 (patch)
tree65c5e067176016ff515419542b41b47c1bbc6044 /net/unix/unix_bpf.c
parentcifs: fix leak of iface for primary channel (diff)
downloadkernel-5eef12c4e3230f2025dc46ad8c4a3bc19978e5d7.tar.gz
kernel-5eef12c4e3230f2025dc46ad8c4a3bc19978e5d7.zip
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: ee1d21794e55 ("cifs: handle when server stops supporting multichannel") Reported-by: Paulo Alcantara <[email protected]> Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
Diffstat (limited to 'net/unix/unix_bpf.c')
0 files changed, 0 insertions, 0 deletions