]> www.infradead.org Git - users/hch/dma-mapping.git/commitdiff
cifs: Fix kmap_local_page() unmapping
authorIra Weiny <ira.weiny@intel.com>
Thu, 29 Dec 2022 22:04:46 +0000 (14:04 -0800)
committerSteve French <stfrench@microsoft.com>
Wed, 4 Jan 2023 06:08:53 +0000 (00:08 -0600)
kmap_local_page() requires kunmap_local() to unmap the mapping.  In
addition memcpy_page() is provided to perform this common memcpy
pattern.

Replace the kmap_local_page() and broken kunmap() with memcpy_page()

Fixes: d406d26745ab ("cifs: skip alloc when request has no pages")
Reviewed-by: Paulo Alcantara <pc@cjr.nz>
Reviewed-by: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2ops.c

index dc160de7a6de4deeebe9616c7b25e8d9bbff52de..0d7e9bcd9f345cc201dd31b3406ff68029071004 100644 (file)
@@ -4488,17 +4488,12 @@ smb3_init_transform_rq(struct TCP_Server_Info *server, int num_rqst,
 
                /* copy pages form the old */
                for (j = 0; j < npages; j++) {
-                       char *dst, *src;
                        unsigned int offset, len;
 
                        rqst_page_get_length(new, j, &len, &offset);
 
-                       dst = kmap_local_page(new->rq_pages[j]) + offset;
-                       src = kmap_local_page(old->rq_pages[j]) + offset;
-
-                       memcpy(dst, src, len);
-                       kunmap(new->rq_pages[j]);
-                       kunmap(old->rq_pages[j]);
+                       memcpy_page(new->rq_pages[j], offset,
+                                   old->rq_pages[j], offset, len);
                }
        }