From: chenxiaosong.chenxiaosong@linux.dev
To: smfrench@gmail.com, linkinjeon@kernel.org, pc@manguebit.org,
ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
bharathsm@microsoft.com, senozhatsky@chromium.org,
dhowells@redhat.com
Cc: linux-cifs@vger.kernel.org,
ZhangGuoDong <zhangguodong@kylinos.cn>,
ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: [PATCH 2/2] smb/server: fix refcount leak in smb2_open()
Date: Mon, 29 Dec 2025 10:13:30 +0800 [thread overview]
Message-ID: <20251229021330.1026506-3-chenxiaosong.chenxiaosong@linux.dev> (raw)
In-Reply-To: <20251229021330.1026506-1-chenxiaosong.chenxiaosong@linux.dev>
From: ZhangGuoDong <zhangguodong@kylinos.cn>
When ksmbd_vfs_getattr() fails, the reference count of ksmbd_file
must be released.
Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
fs/smb/server/smb2pdu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 6a966c696f7d..ed9352753d83 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -3007,8 +3007,10 @@ int smb2_open(struct ksmbd_work *work)
file_info = FILE_OPENED;
rc = ksmbd_vfs_getattr(&fp->filp->f_path, &stat);
- if (rc)
+ if (rc) {
+ ksmbd_put_durable_fd(fp);
goto err_out2;
+ }
ksmbd_put_durable_fd(fp);
goto reconnected_fp;
--
2.43.0
next prev parent reply other threads:[~2025-12-29 2:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-29 2:13 [PATCH 0/2] smb/server: fix some refcount leaks chenxiaosong.chenxiaosong
2025-12-29 2:13 ` [PATCH 1/2] smb/server: fix refcount leak in parse_durable_handle_context() chenxiaosong.chenxiaosong
2025-12-29 2:57 ` Namjae Jeon
2025-12-29 2:13 ` chenxiaosong.chenxiaosong [this message]
2025-12-29 2:56 ` [PATCH 2/2] smb/server: fix refcount leak in smb2_open() Namjae Jeon
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=20251229021330.1026506-3-chenxiaosong.chenxiaosong@linux.dev \
--to=chenxiaosong.chenxiaosong@linux.dev \
--cc=bharathsm@microsoft.com \
--cc=chenxiaosong@kylinos.cn \
--cc=dhowells@redhat.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=pc@manguebit.org \
--cc=ronniesahlberg@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
--cc=zhangguodong@kylinos.cn \
/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