From: Dominique Martinet <asmadeus@codewreck.org>
To: unlisted-recipients:; (no To-header on input)
Cc: Jianyong Wu <jianyong.wu@arm.com>,
lucho@ionkov.net, justin.he@arm.com, ericvh@gmail.com,
qemu_oss@crudebyte.com, groug@kaod.org,
linux-kernel@vger.kernel.org,
v9fs-developer@lists.sourceforge.net,
Dominique Martinet <asmadeus@codewreck.org>
Subject: [PATCH 2/2] 9p: Fix writeback fid incorrectly being attached to dentry
Date: Thu, 19 Nov 2020 17:06:52 +0100 [thread overview]
Message-ID: <1605802012-31133-3-git-send-email-asmadeus@codewreck.org> (raw)
In-Reply-To: <1605802012-31133-1-git-send-email-asmadeus@codewreck.org>
v9fs_dir_release needs fid->ilist to have been initialized for filp's
fid, not the inode's writeback fid's.
With refcounting this can be improved on later but this appears to fix
null deref issues.
Fixes: xxx ("fs/9p: track open fids")
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---
(note: fixes tag can't be filled here, will be corrected later)
fs/9p/vfs_file.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index b0ef225cecd0..c5e49c88688d 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -46,7 +46,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
int err;
struct v9fs_inode *v9inode;
struct v9fs_session_info *v9ses;
- struct p9_fid *fid;
+ struct p9_fid *fid, *writeback_fid;
int omode;
p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
@@ -85,13 +85,13 @@ int v9fs_file_open(struct inode *inode, struct file *file)
* because we want write after unlink usecase
* to work.
*/
- fid = v9fs_writeback_fid(file_dentry(file));
+ writeback_fid = v9fs_writeback_fid(file_dentry(file));
if (IS_ERR(fid)) {
err = PTR_ERR(fid);
mutex_unlock(&v9inode->v_mutex);
goto out_error;
}
- v9inode->writeback_fid = (void *) fid;
+ v9inode->writeback_fid = (void *) writeback_fid;
}
mutex_unlock(&v9inode->v_mutex);
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
--
2.28.0
prev parent reply other threads:[~2020-11-19 16:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 14:11 [PATCH RFC v2 0/4] 9p: fix open-unlink-f*syscall bug Jianyong Wu
2020-09-23 14:11 ` [PATCH v2 1/4] fs/9p: fix create-unlink-getattr idiom Jianyong Wu
2020-09-23 14:11 ` [PATCH v2 2/4] fs/9p: track open fids Jianyong Wu
2020-09-23 14:11 ` [PATCH v2 3/4] fs/9p: search open fids first Jianyong Wu
2020-09-23 14:11 ` [PATCH RFC v2 4/4] 9p: fix race issue in fid contention Jianyong Wu
2020-09-23 14:49 ` Dominique Martinet
2020-09-24 8:38 ` Jianyong Wu
2020-09-24 8:56 ` Greg Kurz
2020-09-24 9:51 ` Dominique Martinet
2020-09-25 9:49 ` Jianyong Wu
2020-11-03 10:41 ` Dominique Martinet
2020-11-04 11:32 ` Christian Schoenebeck
2020-11-04 11:57 ` Dominique Martinet
2020-11-05 12:32 ` Christian Schoenebeck
2020-11-05 7:05 ` Jianyong Wu
2020-11-19 16:06 ` [PATCH 0/2] follow-up to " Dominique Martinet
2020-11-19 16:06 ` [PATCH 1/2] 9p: apply review requests for fid refcounting Dominique Martinet
2020-11-19 16:06 ` Dominique Martinet [this message]
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=1605802012-31133-3-git-send-email-asmadeus@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=ericvh@gmail.com \
--cc=groug@kaod.org \
--cc=jianyong.wu@arm.com \
--cc=justin.he@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=qemu_oss@crudebyte.com \
--cc=v9fs-developer@lists.sourceforge.net \
/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