Add missing increment reference count of parent fp in ksmbd_lookup_fd_inode(). Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxxx> --- 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