[PATCH 4.16 067/113] SMB311: Fix reconnect
From: Greg Kroah-Hartman
Date: Mon Apr 30 2018 - 15:42:15 EST
4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <stfrench@xxxxxxxxxxxxx>
commit 0d5ec281c0175d10f8d9be4d4a9c5fb37767ed00 upstream.
The preauth hash was not being recalculated properly on reconnect
of SMB3.11 dialect mounts (which caused access denied repeatedly
on auto-reconnect).
Fixes: 8bd68c6e47ab ("CIFS: implement v3.11 preauth integrity")
Signed-off-by: Steve French <smfrench@xxxxxxxxx>
CC: Stable <stable@xxxxxxxxxxxxxxx>
Reviewed-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
fs/cifs/transport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -753,7 +753,7 @@ cifs_send_recv(const unsigned int xid, s
goto out;
#ifdef CONFIG_CIFS_SMB311
- if (ses->status == CifsNew)
+ if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP))
smb311_update_preauth_hash(ses, rqst->rq_iov+1,
rqst->rq_nvec-1);
#endif
@@ -797,7 +797,7 @@ cifs_send_recv(const unsigned int xid, s
*resp_buf_type = CIFS_SMALL_BUFFER;
#ifdef CONFIG_CIFS_SMB311
- if (ses->status == CifsNew) {
+ if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP)) {
struct kvec iov = {
.iov_base = buf + 4,
.iov_len = get_rfc1002_length(buf)