[PATCH] ksmbd: Use common code in smb2_get_info_filesystem()

Markus Elfring posted 1 patch 2 months, 2 weeks ago
fs/smb/server/smb2pdu.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
[PATCH] ksmbd: Use common code in smb2_get_info_filesystem()
Posted by Markus Elfring 2 months, 2 weeks ago
From: Markus Elfring <elfring@users.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@users.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