From: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Subject: [PATCH] fs: remove duplicate permission checks in do_sendfile()
Date: Tue, 30 Nov 2021 16:02:18 +0800 [thread overview]
Message-ID: <20211130080218.22517-1-tianjia.zhang@linux.alibaba.com> (raw)
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
next reply other threads:[~2021-11-30 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 8:02 Tianjia Zhang [this message]
2022-01-28 8:48 ` Tianjia Zhang
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=20211130080218.22517-1-tianjia.zhang@linux.alibaba.com \
--to=tianjia.zhang@linux.alibaba.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®