diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 038e428b5173..aecf8ee50c37 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -596,6 +596,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses, */ kfree(ses->auth_key.response); ses->auth_key.response = NULL; + ses->auth_key.len = 0; /* * If memory allocation is successful, caller of this function @@ -756,6 +757,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses, rc = server->ops->generate_signingkey(ses); kfree(ses->auth_key.response); ses->auth_key.response = NULL; + ses->auth_key.len = 0; if (rc) { cifs_dbg(FYI, "SMB3 session key generation failed\n"); @@ -780,6 +782,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses, if (!server->sign) { kfree(ses->auth_key.response); ses->auth_key.response = NULL; + ses->auth_key.len = 0; } kfree(ses->ntlmssp);