Skip to content

Commit ecd9d6b

Browse files
namjaejeonsmfrench
authored andcommitted
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]> Signed-off-by: Steve French <[email protected]>
1 parent 9b493ab commit ecd9d6b

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
@@ -1594,7 +1594,7 @@ static int krb5_authenticate(struct ksmbd_work *work,
15941594
struct ksmbd_conn *conn = work->conn;
15951595
struct ksmbd_session *sess = work->sess;
15961596
char *in_blob, *out_blob;
1597-
struct channel *chann = NULL;
1597+
struct channel *chann = NULL, *old;
15981598
u64 prev_sess_id;
15991599
int in_len, out_len;
16001600
int retval;
@@ -1660,7 +1660,12 @@ static int krb5_authenticate(struct ksmbd_work *work,
16601660
return -ENOMEM;
16611661

16621662
chann->conn = conn;
1663-
xa_store(&sess->ksmbd_chann_list, (long)conn, chann, KSMBD_DEFAULT_GFP);
1663+
old = xa_store(&sess->ksmbd_chann_list, (long)conn,
1664+
chann, KSMBD_DEFAULT_GFP);
1665+
if (xa_is_err(old)) {
1666+
kfree(chann);
1667+
return xa_err(old);
1668+
}
16641669
}
16651670
}
16661671

0 commit comments

Comments
 (0)