]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
SMB3: Kernel oops mounting a encryptData share with CONFIG_DEBUG_VIRTUAL
authorSebastien Tisserant <stisserant@wallix.com>
Thu, 1 Aug 2019 17:06:08 +0000 (12:06 -0500)
committerSteve French <stfrench@microsoft.com>
Tue, 6 Aug 2019 03:50:38 +0000 (22:50 -0500)
Fix kernel oops when mounting a encryptData CIFS share with
CONFIG_DEBUG_VIRTUAL

Signed-off-by: Sebastien Tisserant <stisserant@wallix.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2ops.c

index 19589922ef2b31b7fa9f534814dfd8fc2a58d205..64a5864127be9154fead53d4188a15d3f7ddaf17 100644 (file)
@@ -3489,7 +3489,15 @@ fill_transform_hdr(struct smb2_transform_hdr *tr_hdr, unsigned int orig_len,
 static inline void smb2_sg_set_buf(struct scatterlist *sg, const void *buf,
                                   unsigned int buflen)
 {
-       sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
+       void *addr;
+       /*
+        * VMAP_STACK (at least) puts stack into the vmalloc address space
+        */
+       if (is_vmalloc_addr(buf))
+               addr = vmalloc_to_page(buf);
+       else
+               addr = virt_to_page(buf);
+       sg_set_page(sg, addr, buflen, offset_in_page(buf));
 }
 
 /* Assumes the first rqst has a transform header as the first iov.