From: Namjae Jeon <linkinjeon@kernel.org>
To: linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: smfrench@gmail.com, hyc.lee@gmail.com, senozhatsky@chromium.org,
Namjae Jeon <linkinjeon@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH v2 4/4] ksmbd: increment reference count of parent fp
Date: Sun, 6 Mar 2022 10:10:45 +0900 [thread overview]
Message-ID: <20220306011045.13014-4-linkinjeon@kernel.org> (raw)
In-Reply-To: <20220306011045.13014-1-linkinjeon@kernel.org>
Add missing increment reference count of parent fp in
ksmbd_lookup_fd_inode().
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
v2:
- switch the order of 3/4 and 4/4 patch.
fs/ksmbd/vfs.c | 2 ++
fs/ksmbd/vfs_cache.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c
index f703dbfe22c0..0b92092f3e8a 100644
--- a/fs/ksmbd/vfs.c
+++ b/fs/ksmbd/vfs.c
@@ -769,8 +769,10 @@ int ksmbd_vfs_rename(struct ksmbd_work *work, struct path *old_path,
if (parent_fp->daccess & FILE_DELETE_LE) {
pr_err("parent dir is opened with delete access\n");
err = -ESHARE;
+ ksmbd_fd_put(work, parent_fp);
goto out5;
}
+ ksmbd_fd_put(work, parent_fp);
}
rd.old_mnt_userns = mnt_user_ns(old_path->mnt),
diff --git a/fs/ksmbd/vfs_cache.c b/fs/ksmbd/vfs_cache.c
index ffb534281836..df600eb04552 100644
--- a/fs/ksmbd/vfs_cache.c
+++ b/fs/ksmbd/vfs_cache.c
@@ -493,6 +493,7 @@ struct ksmbd_file *ksmbd_lookup_fd_inode(struct inode *inode)
list_for_each_entry(lfp, &ci->m_fp_list, node) {
if (inode == file_inode(lfp->filp)) {
atomic_dec(&ci->m_count);
+ lfp = ksmbd_fp_get(lfp);
read_unlock(&ci->m_lock);
return lfp;
}
--
2.25.1
prev parent reply other threads:[~2022-03-06 1:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-06 1:10 [PATCH 1/4] ksmbd: remove internal.h include Namjae Jeon
2022-03-06 1:10 ` [PATCH v2 2/4] ksmbd: remove filename in ksmbd_file Namjae Jeon
2022-03-06 1:10 ` [PATCH v4 3/4] ksmbd: fix racy issue from using ->d_parent and ->d_name Namjae Jeon
2022-03-06 1:10 ` Namjae Jeon [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=20220306011045.13014-4-linkinjeon@kernel.org \
--to=linkinjeon@kernel.org \
--cc=hyc.lee@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
--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