Skip to content

Commit 5ba044e

Browse files
committed
ksmbd: check return value of xa_store() in krb5_authenticate
xa_store() may fail so check its return value and return error code if error occurred. Signed-off-by: Namjae Jeon <[email protected]>
1 parent 0324164 commit 5ba044e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

smb2pdu.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ static int krb5_authenticate(struct ksmbd_work *work,
16091609
struct ksmbd_conn *conn = work->conn;
16101610
struct ksmbd_session *sess = work->sess;
16111611
char *in_blob, *out_blob;
1612-
struct channel *chann = NULL;
1612+
struct channel *chann = NULL, *old;
16131613
u64 prev_sess_id;
16141614
int in_len, out_len;
16151615
int retval;
@@ -1675,7 +1675,12 @@ static int krb5_authenticate(struct ksmbd_work *work,
16751675
return -ENOMEM;
16761676

16771677
chann->conn = conn;
1678-
xa_store(&sess->ksmbd_chann_list, (long)conn, chann, KSMBD_DEFAULT_GFP);
1678+
old = xa_store(&sess->ksmbd_chann_list, (long)conn,
1679+
chann, KSMBD_DEFAULT_GFP);
1680+
if (xa_is_err(old)) {
1681+
kfree(chann);
1682+
return xa_err(old);
1683+
}
16791684
}
16801685
}
16811686

0 commit comments

Comments
 (0)