smb: server: smb2pdu: check return value of xa_store()
Subsystems (2)
PATCH v3 1/1 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 <[email protected]>
---
Change in v3:
- Replace goto free_chann by kfree(chann) and return xa_err(old).
fs/smb/server/smb2pdu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/smb/server/smb2pdu.c +7 -2
@@ -1445,7 +1445,7 @@ static int ntlm_authenticate(struct ksmbd_work *work, {struct ksmbd_conn *conn = work->conn;struct ksmbd_session *sess = work->sess; -struct channel *chann =NULL ; +struct channel *chann =NULL , *old;struct ksmbd_user *user;u64 prev_id;int sz, rc;
@@ -1557,7 +1557,12 @@ static int ntlm_authenticate(struct ksmbd_work *work,return -ENOMEM ; chann->conn = conn; -xa_store (&sess->ksmbd_chann_list, (long )conn, chann,KSMBD_DEFAULT_GFP ); + old =xa_store (&sess->ksmbd_chann_list, (long )conn, chann, +KSMBD_DEFAULT_GFP ); +if (xa_is_err (old)) { +kfree (chann); +return xa_err (old); + } } }
Signature · 1 line
2.43.0
Quoted 5 lines · Salah Triki
xa_store()may fail so check its return value and return error code if error occurred.Signed-off-by Salah Triki <[email protected]>
Applied it to #ksmbd-for-next-next.
Thanks!