Skip to content

Commit df3abea

Browse files
salah-trikijfvogel
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> (cherry picked from commit aa000a4ee9897762a254bd190ac314366fb7f0f3) Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
1 parent 7e92d4a commit df3abea

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
@@ -1448,7 +1448,7 @@ static int ntlm_authenticate(struct ksmbd_work *work,
14481448
{
14491449
struct ksmbd_conn *conn = work->conn;
14501450
struct ksmbd_session *sess = work->sess;
1451-
struct channel *chann = NULL;
1451+
struct channel *chann = NULL, *old;
14521452
struct ksmbd_user *user;
14531453
u64 prev_id;
14541454
int sz, rc;
@@ -1560,7 +1560,12 @@ static int ntlm_authenticate(struct ksmbd_work *work,
15601560
return -ENOMEM;
15611561

15621562
chann->conn = conn;
1563-
xa_store(&sess->ksmbd_chann_list, (long)conn, chann, KSMBD_DEFAULT_GFP);
1563+
old = xa_store(&sess->ksmbd_chann_list, (long)conn, chann,
1564+
KSMBD_DEFAULT_GFP);
1565+
if (xa_is_err(old)) {
1566+
kfree(chann);
1567+
return xa_err(old);
1568+
}
15641569
}
15651570
}
15661571

0 commit comments

Comments
 (0)