Skip to content

Commit 39e8db3

Browse files
Paulo AlcantaraSteve French
authored andcommitted
cifs: fix double free on failed kerberos auth
If session setup failed with kerberos auth, we ended up freeing cifs_ses::auth_key.response twice in SMB2_auth_kerberos() and sesInfoFree(). Fix this by zeroing out cifs_ses::auth_key.response after freeing it in SMB2_auth_kerberos(). Fixes: a4e430c ("cifs: replace kfree() with kfree_sensitive() for sensitive data") Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Acked-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 2f57e44 commit 39e8db3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/cifs/smb2pdu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,8 +1482,11 @@ SMB2_auth_kerberos(struct SMB2_sess_data *sess_data)
14821482
out_put_spnego_key:
14831483
key_invalidate(spnego_key);
14841484
key_put(spnego_key);
1485-
if (rc)
1485+
if (rc) {
14861486
kfree_sensitive(ses->auth_key.response);
1487+
ses->auth_key.response = NULL;
1488+
ses->auth_key.len = 0;
1489+
}
14871490
out:
14881491
sess_data->result = rc;
14891492
sess_data->func = NULL;

0 commit comments

Comments
 (0)