* [PATCH RESEND] ksmbd: increment reference count of parent fp
@ 2022-04-12 22:57 Namjae Jeon
2022-04-13 23:31 ` Hyunchul Lee
0 siblings, 1 reply; 2+ messages in thread
From: Namjae Jeon @ 2022-04-12 22:57 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, hyc.lee, senozhatsky, Namjae Jeon
Add missing increment reference count of parent fp in
ksmbd_lookup_fd_inode().
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
fs/ksmbd/smb2pdu.c | 2 ++
fs/ksmbd/vfs_cache.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index e38fb68ded21..62cc0f95ab87 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -5758,8 +5758,10 @@ static int set_rename_info(struct ksmbd_work *work, struct ksmbd_file *fp,
if (parent_fp) {
if (parent_fp->daccess & FILE_DELETE_LE) {
pr_err("parent dir is opened with delete access\n");
+ ksmbd_fd_put(work, parent_fp);
return -ESHARE;
}
+ ksmbd_fd_put(work, parent_fp);
}
next:
return smb2_rename(work, fp, user_ns, rename_info,
diff --git a/fs/ksmbd/vfs_cache.c b/fs/ksmbd/vfs_cache.c
index 0974d2e972b9..c4d59d2735f0 100644
--- a/fs/ksmbd/vfs_cache.c
+++ b/fs/ksmbd/vfs_cache.c
@@ -496,6 +496,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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] ksmbd: increment reference count of parent fp
2022-04-12 22:57 [PATCH RESEND] ksmbd: increment reference count of parent fp Namjae Jeon
@ 2022-04-13 23:31 ` Hyunchul Lee
0 siblings, 0 replies; 2+ messages in thread
From: Hyunchul Lee @ 2022-04-13 23:31 UTC (permalink / raw)
To: Namjae Jeon; +Cc: linux-cifs, Steve French, Sergey Senozhatsky
2022년 4월 13일 (수) 오전 7:57, Namjae Jeon <linkinjeon@kernel.org>님이 작성:
>
> Add missing increment reference count of parent fp in
> ksmbd_lookup_fd_inode().
>
> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> ---
Looks good to me.
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
> fs/ksmbd/smb2pdu.c | 2 ++
> fs/ksmbd/vfs_cache.c | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
> index e38fb68ded21..62cc0f95ab87 100644
> --- a/fs/ksmbd/smb2pdu.c
> +++ b/fs/ksmbd/smb2pdu.c
> @@ -5758,8 +5758,10 @@ static int set_rename_info(struct ksmbd_work *work, struct ksmbd_file *fp,
> if (parent_fp) {
> if (parent_fp->daccess & FILE_DELETE_LE) {
> pr_err("parent dir is opened with delete access\n");
> + ksmbd_fd_put(work, parent_fp);
> return -ESHARE;
> }
> + ksmbd_fd_put(work, parent_fp);
> }
> next:
> return smb2_rename(work, fp, user_ns, rename_info,
> diff --git a/fs/ksmbd/vfs_cache.c b/fs/ksmbd/vfs_cache.c
> index 0974d2e972b9..c4d59d2735f0 100644
> --- a/fs/ksmbd/vfs_cache.c
> +++ b/fs/ksmbd/vfs_cache.c
> @@ -496,6 +496,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
>
--
Thanks,
Hyunchul
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-13 23:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 22:57 [PATCH RESEND] ksmbd: increment reference count of parent fp Namjae Jeon
2022-04-13 23:31 ` Hyunchul Lee
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.