cifs: fix uninitialised lease_key in open_shroot()
authorPaulo Alcantara <pc@cjr.nz>
Tue, 21 Apr 2020 02:44:24 +0000 (23:44 -0300)
committerSteve French <stfrench@microsoft.com>
Thu, 23 Apr 2020 01:29:11 +0000 (20:29 -0500)
SMB2_open_init() expects a pre-initialised lease_key when opening a
file with a lease, so set pfid->lease_key prior to calling it in
open_shroot().

This issue was observed when performing some DFS failover tests and
the lease key was never randomly generated.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
CC: Stable <stable@vger.kernel.org>
fs/cifs/smb2ops.c

index b36c46f48705c7cc6c46683313b6b02505fd3ebb..f829f4165d38c1b196481b91d2d172b1c96090ec 100644 (file)
@@ -687,6 +687,11 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon,
        if (smb3_encryption_required(tcon))
                flags |= CIFS_TRANSFORM_REQ;
 
+       if (!server->ops->new_lease_key)
+               return -EIO;
+
+       server->ops->new_lease_key(pfid);
+
        memset(rqst, 0, sizeof(rqst));
        resp_buftype[0] = resp_buftype[1] = CIFS_NO_BUFFER;
        memset(rsp_iov, 0, sizeof(rsp_iov));