From 69f447be15130b57cc00fa0a5c2d3fa949a46165 Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Tue, 30 Mar 2021 12:38:03 +0900 Subject: [PATCH] cifsd: fix wrong use of rw semaphore in __session_create() Adding list to session table should be protected by down_write/up_write(). Signed-off-by: Namjae Jeon Signed-off-by: Steve French --- fs/cifsd/mgmt/user_session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/cifsd/mgmt/user_session.c b/fs/cifsd/mgmt/user_session.c index afcdf76a3851..1b71a20dacdb 100644 --- a/fs/cifsd/mgmt/user_session.c +++ b/fs/cifsd/mgmt/user_session.c @@ -298,9 +298,9 @@ static struct ksmbd_session *__session_create(int protocol) goto error; if (protocol == CIFDS_SESSION_FLAG_SMB2) { - down_read(&sessions_table_lock); + down_write(&sessions_table_lock); hash_add(sessions_table, &sess->hlist, sess->id); - up_read(&sessions_table_lock); + up_write(&sessions_table_lock); } return sess;