* [PATCH] cifs: Fix kmap_local_page() unmapping
@ 2022-12-29 22:04 Ira Weiny
2022-12-29 22:13 ` Paulo Alcantara
2022-12-29 22:25 ` Fabio M. De Francesco
0 siblings, 2 replies; 4+ messages in thread
From: Ira Weiny @ 2022-12-29 22:04 UTC (permalink / raw)
To: Ira Weiny
Cc: Paulo Alcantara, Steve French, Fabio M. De Francesco, linux-cifs,
samba-technical
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>
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] cifs: Fix kmap_local_page() unmapping
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
1 sibling, 0 replies; 4+ messages in thread
From: Paulo Alcantara @ 2022-12-29 22:13 UTC (permalink / raw)
To: Ira Weiny, Ira Weiny
Cc: Steve French, Fabio M. De Francesco, linux-cifs, samba-technical
Ira Weiny <ira.weiny@intel.com> writes:
> 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(-)
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] cifs: Fix kmap_local_page() unmapping
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
2023-01-04 6:15 ` Steve French
1 sibling, 1 reply; 4+ messages in thread
From: Fabio M. De Francesco @ 2022-12-29 22:25 UTC (permalink / raw)
To: Ira Weiny, Ira Weiny
Cc: Paulo Alcantara, Steve French, linux-cifs, samba-technical
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>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] cifs: Fix kmap_local_page() unmapping
2022-12-29 22:25 ` Fabio M. De Francesco
@ 2023-01-04 6:15 ` Steve French
0 siblings, 0 replies; 4+ messages in thread
From: Steve French @ 2023-01-04 6:15 UTC (permalink / raw)
To: Fabio M. De Francesco
Cc: Ira Weiny, Paulo Alcantara, Steve French, linux-cifs,
samba-technical
merged into cifs-2.6.git for-next pending testing
On Thu, Dec 29, 2022 at 4:38 PM Fabio M. De Francesco
<fmdefrancesco@gmail.com> wrote:
>
> 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>
>
>
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-04 6:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-01-04 6:15 ` Steve French
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox