aboutsummaryrefslogtreecommitdiff
path: root/fs/ksmbd/vfs.c
diff options
context:
space:
mode:
authorGravatar Namjae Jeon <linkinjeon@kernel.org> 2022-07-25 13:36:52 +0900
committerGravatar Steve French <stfrench@microsoft.com> 2022-07-31 23:14:32 -0500
commitaf7c39d971e43cd0af488729bca362427ad99488 (patch)
tree3c174aa7d504f663a6741a5dffee77666f86df65 /fs/ksmbd/vfs.c
parentksmbd: use wait_event instead of schedule_timeout() (diff)
downloadlinux-af7c39d971e43cd0af488729bca362427ad99488.tar.gz
linux-af7c39d971e43cd0af488729bca362427ad99488.tar.bz2
linux-af7c39d971e43cd0af488729bca362427ad99488.zip
ksmbd: fix racy issue while destroying session on multichannel
After multi-channel connection with windows, Several channels of session are connected. Among them, if there is a problem in one channel, Windows connects again after disconnecting the channel. In this process, the session is released and a kernel oop can occurs while processing requests to other channels. When the channel is disconnected, if other channels still exist in the session after deleting the channel from the channel list in the session, the session should not be released. Finally, the session will be released after all channels are disconnected. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/ksmbd/vfs.c')
-rw-r--r--fs/ksmbd/vfs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c
index 05efcdf7a4a7..c23793469645 100644
--- a/fs/ksmbd/vfs.c
+++ b/fs/ksmbd/vfs.c
@@ -481,12 +481,11 @@ int ksmbd_vfs_write(struct ksmbd_work *work, struct ksmbd_file *fp,
char *buf, size_t count, loff_t *pos, bool sync,
ssize_t *written)
{
- struct ksmbd_session *sess = work->sess;
struct file *filp;
loff_t offset = *pos;
int err = 0;
- if (sess->conn->connection_type) {
+ if (work->conn->connection_type) {
if (!(fp->daccess & FILE_WRITE_DATA_LE)) {
pr_err("no right to write(%pd)\n",
fp->filp->f_path.dentry);