mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Namjae Jeon <linkinjeon@kernel.org>,
	Hyunchul Lee <hyc.lee@gmail.com>,
	Steve French <stfrench@microsoft.com>,
	Sasha Levin <sashal@kernel.org>,
	sfrench@samba.org, linux-cifs@vger.kernel.org
Subject: [PATCH AUTOSEL 5.15 05/15] ksmbd: increment reference count of parent fp
Date: Tue, 26 Apr 2022 15:02:04 -0400	[thread overview]
Message-ID: <20220426190216.2351413-5-sashal@kernel.org> (raw)
In-Reply-To: <20220426190216.2351413-1-sashal@kernel.org>

From: Namjae Jeon <linkinjeon@kernel.org>

[ Upstream commit 8510a043d334ecdf83d4604782f288db6bf21d60 ]

Add missing increment reference count of parent fp in
ksmbd_lookup_fd_inode().

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@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 192d8308afc2..a9fdb47c2791 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -5768,8 +5768,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 29c1db66bd0f..8b873d92d785 100644
--- a/fs/ksmbd/vfs_cache.c
+++ b/fs/ksmbd/vfs_cache.c
@@ -497,6 +497,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.35.1


  parent reply	other threads:[~2022-04-26 19:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 19:02 [PATCH AUTOSEL 5.15 01/15] ASoC: Intel: soc-acpi: correct device endpoints for max98373 Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 02/15] ASoC: wm8731: Disable the regulator when probing fails Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 03/15] ext4: fix bug_on in start_this_handle during umount filesystem Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 04/15] arch: xtensa: platforms: Fix deadlock in rs_close() Sasha Levin
2022-04-26 19:02 ` Sasha Levin [this message]
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 06/15] ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 07/15] ip6_gre: Avoid updating tunnel->tun_hlen in __gre6_xmit() Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 08/15] bonding: do not discard lowest hash bit for non layer3+4 hashing Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 09/15] x86: __memcpy_flushcache: fix wrong alignment if size > 2^32 Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 10/15] cifs: destage any unwritten data to the server before calling copychunk_write Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 11/15] drivers: net: hippi: Fix deadlock in rr_close() Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 12/15] powerpc/perf: Fix 32bit compile Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 13/15] ata: pata_marvell: Check the 'bmdma_addr' beforing reading Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 14/15] selftest/vm: verify mmap addr in mremap_test Sasha Levin
2022-04-26 19:02 ` [PATCH AUTOSEL 5.15 15/15] selftest/vm: verify remap destination address " Sasha Levin

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=20220426190216.2351413-5-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfrench@samba.org \
    --cc=stable@vger.kernel.org \
    --cc=stfrench@microsoft.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

all inboxes | Powered by JetHome®