From: Sebastien Tisserant Date: Thu, 1 Aug 2019 17:06:08 +0000 (-0500) Subject: SMB3: Kernel oops mounting a encryptData share with CONFIG_DEBUG_VIRTUAL X-Git-Tag: v4.14.141~41 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5a166c83eeadf349ffd91bc787fd0dae1bc5ff6c;p=users%2Fdwmw2%2Flinux.git SMB3: Kernel oops mounting a encryptData share with CONFIG_DEBUG_VIRTUAL [ Upstream commit ee9d66182392695535cc9fccfcb40c16f72de2a9 ] Fix kernel oops when mounting a encryptData CIFS share with CONFIG_DEBUG_VIRTUAL Signed-off-by: Sebastien Tisserant Reviewed-by: Pavel Shilovsky Signed-off-by: Steve French Signed-off-by: Sasha Levin --- diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 23326b0cd5628..58a502e622aa4 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -2168,7 +2168,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 *