cifs: fix double free on failed kerberos auth
authorPaulo Alcantara <pc@cjr.nz>
Tue, 10 Jan 2023 20:55:20 +0000 (17:55 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:15 +0000 (11:58 +0100)
commitf0f326dc9794cc5820e0804d8702d5a10fb84aca
tree7641dff22def76114268c1c6764c4b3560b30a7b
parent888c060bc327e6a231304aefc0f30e97b1640338
cifs: fix double free on failed kerberos auth

commit 39e8db3c860e2678ce5a7d74193925876507c9eb upstream.

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: a4e430c8c8ba ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2pdu.c