Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Paulo Alcantara <pc@cjr.nz>, Steve French <sfrench@samba.org>,
	"Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org
Subject: [PATCH] cifs: Fix kmap_local_page() unmapping
Date: Thu, 29 Dec 2022 14:04:46 -0800	[thread overview]
Message-ID: <20221229-cifs-kmap-v1-1-c70d0e9a53eb@intel.com> (raw)

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")
Cc: Paulo Alcantara <pc@cjr.nz>
Cc: Steve French <sfrench@samba.org>
Cc: "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>
---
 fs/cifs/smb2ops.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index dc160de7a6de..0d7e9bcd9f34 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -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);
 		}
 	}
 

---
base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
change-id: 20221229-cifs-kmap-6700dabafcdf

Best regards,
-- 
Ira Weiny <ira.weiny@intel.com>

             reply	other threads:[~2022-12-29 22:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29 22:04 Ira Weiny [this message]
2022-12-29 22:13 ` [PATCH] cifs: Fix kmap_local_page() unmapping Paulo Alcantara
2022-12-29 22:25 ` Fabio M. De Francesco
2023-01-04  6:15   ` Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221229-cifs-kmap-v1-1-c70d0e9a53eb@intel.com \
    --to=ira.weiny@intel.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@cjr.nz \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox