All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: remove duplicate permission checks in do_sendfile()
@ 2021-11-30  8:02 Tianjia Zhang
  2022-01-28  8:48 ` Tianjia Zhang
  0 siblings, 1 reply; 2+ messages in thread
From: Tianjia Zhang @ 2021-11-30  8:02 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel, linux-kernel; +Cc: Tianjia Zhang

The permission check for out.file is mainly performed in the function
rw_verify_area(), and this check is called twice in the function
do_splice_direct() and before calling do_splice_direct(). This is a
redundant check and it is necessary to remove.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 fs/read_write.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 0074afa7ecb3..bc7c3fcc3400 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1238,9 +1238,6 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
 #endif
 	opipe = get_pipe_info(out.file, true);
 	if (!opipe) {
-		retval = rw_verify_area(WRITE, out.file, &out_pos, count);
-		if (retval < 0)
-			goto fput_out;
 		file_start_write(out.file);
 		retval = do_splice_direct(in.file, &pos, out.file, &out_pos,
 					  count, fl);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs: remove duplicate permission checks in do_sendfile()
  2021-11-30  8:02 [PATCH] fs: remove duplicate permission checks in do_sendfile() Tianjia Zhang
@ 2022-01-28  8:48 ` Tianjia Zhang
  0 siblings, 0 replies; 2+ messages in thread
From: Tianjia Zhang @ 2022-01-28  8:48 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel, linux-kernel

ping.

Thanks.

On 11/30/21 4:02 PM, Tianjia Zhang wrote:
> The permission check for out.file is mainly performed in the function
> rw_verify_area(), and this check is called twice in the function
> do_splice_direct() and before calling do_splice_direct(). This is a
> redundant check and it is necessary to remove.
> 
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>   fs/read_write.c | 3 ---
>   1 file changed, 3 deletions(-)
> 
> diff --git a/fs/read_write.c b/fs/read_write.c
> index 0074afa7ecb3..bc7c3fcc3400 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -1238,9 +1238,6 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
>   #endif
>   	opipe = get_pipe_info(out.file, true);
>   	if (!opipe) {
> -		retval = rw_verify_area(WRITE, out.file, &out_pos, count);
> -		if (retval < 0)
> -			goto fput_out;
>   		file_start_write(out.file);
>   		retval = do_splice_direct(in.file, &pos, out.file, &out_pos,
>   					  count, fl);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-28  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30  8:02 [PATCH] fs: remove duplicate permission checks in do_sendfile() Tianjia Zhang
2022-01-28  8:48 ` Tianjia Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.