]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 4 Sep 2019 06:16:38 +0000 (02:16 -0400)
BugLink: https://bugs.launchpad.net/bugs/1842114
[ Upstream commit ee9d66182392695535cc9fccfcb40c16f72de2a9 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/cifs/smb2ops.c

index 47280135fc73783a16d5247d64a6028212fec70b..0e9031126e6199c13b95c0b0c4d0cdb9612d35cf 100644 (file)
@@ -2162,7 +2162,15 @@ fill_transform_hdr(struct smb2_transform_hdr *tr_hdr, struct smb_rqst *old_rq)
 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));
 }
 
 static struct scatterlist *