Linux CIFS filesystem development
 help / color / mirror / Atom feed
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 v2 1/1] smb/server: fix refcount leak in smb2_open()
Date: Mon, 29 Dec 2025 11:15:18 +0800	[thread overview]
Message-ID: <20251229031518.1027240-2-chenxiaosong.chenxiaosong@linux.dev> (raw)
In-Reply-To: <20251229031518.1027240-1-chenxiaosong.chenxiaosong@linux.dev>

From: ZhangGuoDong <zhangguodong@kylinos.cn>

When ksmbd_vfs_getattr() fails, the reference count of ksmbd_file
must be released.

Suggested-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
 fs/smb/server/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 6a966c696f7d..dc730fe348e4 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -3007,10 +3007,10 @@ int smb2_open(struct ksmbd_work *work)
 			file_info = FILE_OPENED;
 
 			rc = ksmbd_vfs_getattr(&fp->filp->f_path, &stat);
+			ksmbd_put_durable_fd(fp);
 			if (rc)
 				goto err_out2;
 
-			ksmbd_put_durable_fd(fp);
 			goto reconnected_fp;
 		}
 	} else if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE)
-- 
2.43.0


  reply	other threads:[~2025-12-29  3:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-29  3:15 [PATCH v2 0/1] smb/server: fix some refcount leaks chenxiaosong.chenxiaosong
2025-12-29  3:15 ` chenxiaosong.chenxiaosong [this message]
2025-12-29  4:06   ` [PATCH v2 1/1] smb/server: fix refcount leak in smb2_open() Namjae Jeon
2026-02-25 16:49   ` Guenter Roeck
2026-02-26  4:12     ` ChenXiaoSong
2026-02-26  4:27       ` Guenter Roeck
2026-02-26  5:09       ` Guenter Roeck
2026-02-27  4:07         ` ChenXiaoSong
2026-02-27  4:12           ` ChenXiaoSong
2026-02-27  4:43             ` Namjae Jeon
2026-02-27  4:42           ` Guenter Roeck
2026-02-27  4:53             ` ChenXiaoSong

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=20251229031518.1027240-2-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