summaryrefslogtreecommitdiff
path: root/fs/ksmbd/server.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-08-08 20:15:13 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-08-08 20:15:13 -0700
commiteb555cb5b794f4e12a9897f3d46d5a72104cd4a7 (patch)
treeab35899895fd36207fab74cf323c93e2ca41d463 /fs/ksmbd/server.c
parentf30adc0d332fdfe5315cb98bd6a7ff0d5cf2aa38 (diff)
parent8f0541186e9ad1b62accc9519cc2b7a7240272a7 (diff)
downloadlinux-eb555cb5b794f4e12a9897f3d46d5a72104cd4a7.tar.gz
linux-eb555cb5b794f4e12a9897f3d46d5a72104cd4a7.tar.bz2
linux-eb555cb5b794f4e12a9897f3d46d5a72104cd4a7.zip
Merge tag '5.20-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd
Pull ksmbd updates from Steve French: - fixes for memory access bugs (out of bounds access, oops, leak) - multichannel fixes - session disconnect performance improvement, and session register improvement - cleanup * tag '5.20-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd: ksmbd: fix heap-based overflow in set_ntacl_dacl() ksmbd: prevent out of bound read for SMB2_TREE_CONNNECT ksmbd: prevent out of bound read for SMB2_WRITE ksmbd: fix use-after-free bug in smb2_tree_disconect ksmbd: fix memory leak in smb2_handle_negotiate ksmbd: fix racy issue while destroying session on multichannel ksmbd: use wait_event instead of schedule_timeout() ksmbd: fix kernel oops from idr_remove() ksmbd: add channel rwlock ksmbd: replace sessions list in connection with xarray MAINTAINERS: ksmbd: add entry for documentation ksmbd: remove unused ksmbd_share_configs_cleanup function
Diffstat (limited to 'fs/ksmbd/server.c')
-rw-r--r--fs/ksmbd/server.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ksmbd/server.c b/fs/ksmbd/server.c
index 4cd03d661df0..ce42bff42ef9 100644
--- a/fs/ksmbd/server.c
+++ b/fs/ksmbd/server.c
@@ -261,7 +261,13 @@ static void handle_ksmbd_work(struct work_struct *wk)
ksmbd_conn_try_dequeue_request(work);
ksmbd_free_work_struct(work);
- atomic_dec(&conn->r_count);
+ /*
+ * Checking waitqueue to dropping pending requests on
+ * disconnection. waitqueue_active is safe because it
+ * uses atomic operation for condition.
+ */
+ if (!atomic_dec_return(&conn->r_count) && waitqueue_active(&conn->r_count_q))
+ wake_up(&conn->r_count_q);
}
/**