From: Shuah Khan <skhan@linuxfoundation.org>
To: viro@zeniv.linux.org.uk, axboe@kernel.dk,
zohar@linux.vnet.ibm.com, mcgrof@kernel.org,
keescook@chromium.org
Cc: Shuah Khan <skhan@linuxfoundation.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd()
Date: Tue, 12 May 2020 13:43:05 -0600 [thread overview]
Message-ID: <1159d74f88d100521c568037327ebc8ec7ffc6ef.1589311577.git.skhan@linuxfoundation.org> (raw)
In-Reply-To: <cover.1589311577.git.skhan@linuxfoundation.org>
Fix kernel_read_file_from_fd() to avoid fdput() after a failed fdget().
fdput() doesn't do fput() on this file since FDPUT_FPUT isn't set
in fd.flags. Fix it anyway since failed fdget() doesn't require
a fdput().
This was introduced in a commit that added kernel_read_file_from_fd() as
a wrapper for the VFS common kernel_read_file().
Fixes: b844f0ecbc56 ("vfs: define kernel_copy_file_from_fd()")
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
fs/exec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/exec.c b/fs/exec.c
index 06b4c550af5d..ea24bdce939d 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1021,8 +1021,8 @@ int kernel_read_file_from_fd(int fd, void **buf, loff_t *size, loff_t max_size,
goto out;
ret = kernel_read_file(f.file, buf, size, max_size, id);
-out:
fdput(f);
+out:
return ret;
}
EXPORT_SYMBOL_GPL(kernel_read_file_from_fd);
--
2.25.1
next prev parent reply other threads:[~2020-05-12 19:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 19:43 [PATCH v2 0/2] fs: avoid fdput() after failed fdget() Shuah Khan
2020-05-12 19:43 ` [PATCH v2 1/2] fs: avoid fdput() after failed fdget() in ksys_sync_file_range() Shuah Khan
2020-05-13 5:46 ` Al Viro
2020-05-12 19:43 ` Shuah Khan [this message]
2020-05-13 5:49 ` [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd() Al Viro
2020-05-13 13:13 ` Luis Chamberlain
2020-05-13 14:19 ` Luis Chamberlain
2020-05-22 21:59 ` Scott Branden
2020-05-22 22:14 ` Scott Branden
2020-05-22 22:47 ` Luis Chamberlain
2020-05-13 17:56 ` Shuah Khan
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=1159d74f88d100521c568037327ebc8ec7ffc6ef.1589311577.git.skhan@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=axboe@kernel.dk \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=zohar@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).