Skip to content

Commit 5efeafb

Browse files
salah-trikiSasha Levin
authored andcommitted
smb: server: smb2pdu: check return value of xa_store()
[ Upstream commit af5226a ] xa_store() may fail so check its return value and return error code if error occurred. Signed-off-by: Salah Triki <salah.triki@gmail.com> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6cbeee1 commit 5efeafb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ static int ntlm_authenticate(struct ksmbd_work *work,
14501450
{
14511451
struct ksmbd_conn *conn = work->conn;
14521452
struct ksmbd_session *sess = work->sess;
1453-
struct channel *chann = NULL;
1453+
struct channel *chann = NULL, *old;
14541454
struct ksmbd_user *user;
14551455
u64 prev_id;
14561456
int sz, rc;
@@ -1562,7 +1562,12 @@ static int ntlm_authenticate(struct ksmbd_work *work,
15621562
return -ENOMEM;
15631563

15641564
chann->conn = conn;
1565-
xa_store(&sess->ksmbd_chann_list, (long)conn, chann, KSMBD_DEFAULT_GFP);
1565+
old = xa_store(&sess->ksmbd_chann_list, (long)conn, chann,
1566+
KSMBD_DEFAULT_GFP);
1567+
if (xa_is_err(old)) {
1568+
kfree(chann);
1569+
return xa_err(old);
1570+
}
15661571
}
15671572
}
15681573

0 commit comments

Comments
 (0)