lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <84394500-a8c6-441b-8ad7-8dab2b3c1852@web.de>
Date: Tue, 30 Sep 2025 15:30:33 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-cifs@...r.kernel.org, Matvey Kovalev <matvey.kovalev@...ras.ru>,
 Namjae Jeon <linkinjeon@...nel.org>,
 Sergey Senozhatsky <senozhatsky@...omium.org>,
 Steve French <smfrench@...il.com>, Tom Talpey <tom@...pey.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org
Subject: [PATCH] ksmbd: Use common code in smb2_get_info_filesystem()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 30 Sep 2025 15:21:37 +0200

Use two additional labels so that another bit of common code can be better
reused at the end of this function implementation.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 fs/smb/server/smb2pdu.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index ab1d45fcebde..1d70278890e4 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -5459,8 +5459,8 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
 	rc = vfs_statfs(&path, &stfs);
 	if (rc) {
 		pr_err("cannot do stat of path %s\n", share->path);
-		path_put(&path);
-		return -EIO;
+		rc = -EIO;
+		goto put_path;
 	}
 
 	fsinfoclass = req->FileInfoClass;
@@ -5629,8 +5629,7 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
 
 		if (!work->tcon->posix_extensions) {
 			pr_err("client doesn't negotiate with SMB3.1.1 POSIX Extensions\n");
-			path_put(&path);
-			return -EOPNOTSUPP;
+			goto e_opnotsupp;
 		} else {
 			info = (struct filesystem_posix_info *)(rsp->Buffer);
 			info->OptimalTransferSize = cpu_to_le32(stfs.f_bsize);
@@ -5645,11 +5644,13 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
 		break;
 	}
 	default:
-		path_put(&path);
-		return -EOPNOTSUPP;
+e_opnotsupp:
+		rc = -EOPNOTSUPP;
+		goto put_path;
 	}
 	rc = buffer_check_err(le32_to_cpu(req->OutputBufferLength),
 			      rsp, work->response_buf);
+put_path:
 	path_put(&path);
 	return rc;
 }
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ