Skip to content

Commit af5226a

Browse files
salah-trikiSteve French
authored andcommitted
smb: server: smb2pdu: check return value of xa_store()
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>
1 parent 9c32cda commit af5226a

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
@@ -1445,7 +1445,7 @@ static int ntlm_authenticate(struct ksmbd_work *work,
14451445
{
14461446
struct ksmbd_conn *conn = work->conn;
14471447
struct ksmbd_session *sess = work->sess;
1448-
struct channel *chann = NULL;
1448+
struct channel *chann = NULL, *old;
14491449
struct ksmbd_user *user;
14501450
u64 prev_id;
14511451
int sz, rc;
@@ -1557,7 +1557,12 @@ static int ntlm_authenticate(struct ksmbd_work *work,
15571557
return -ENOMEM;
15581558

15591559
chann->conn = conn;
1560-
xa_store(&sess->ksmbd_chann_list, (long)conn, chann, KSMBD_DEFAULT_GFP);
1560+
old = xa_store(&sess->ksmbd_chann_list, (long)conn, chann,
1561+
KSMBD_DEFAULT_GFP);
1562+
if (xa_is_err(old)) {
1563+
kfree(chann);
1564+
return xa_err(old);
1565+
}
15611566
}
15621567
}
15631568

0 commit comments

Comments
 (0)