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

On giovedì 29 dicembre 2022 23:04:46 CET Ira Weiny wrote:
> 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);
>
FWIW, it looks good to me...

Reviewed-by: Fabio M. De Francesco

Thanks,

Fabio
>  		}
>  	}
> 
> 
> ---
> base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
> change-id: 20221229-cifs-kmap-6700dabafcdf
> 
> Best regards,
> --
> Ira Weiny <ira.weiny@intel.com>




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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29 22:04 [PATCH] cifs: Fix kmap_local_page() unmapping Ira Weiny
2022-12-29 22:13 ` Paulo Alcantara
2022-12-29 22:25 ` Fabio M. De Francesco [this message]
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=13173438.uLZWGnKmhe@suse \
    --to=fmdefrancesco@gmail.com \
    --cc=ira.weiny@intel.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