]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ksmbd: use volume UUID in FS_OBJECT_ID_INFORMATION
authorNamjae Jeon <linkinjeon@kernel.org>
Fri, 13 Mar 2026 01:01:29 +0000 (10:01 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:47 +0000 (11:08 +0100)
commit 3a64125730cabc34fccfbc230c2667c2e14f7308 upstream.

Use sb->s_uuid for a proper volume identifier as the primary choice.
For filesystems that do not provide a UUID, fall back to stfs.f_fsid
obtained from vfs_statfs().

Cc: stable@vger.kernel.org
Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/server/smb2pdu.c

index 5a9f57c9c9974b77b98205f7a84604053f67b5d0..8574a518014f4b9ffaf5b2d6d9ea567e168fd129 100644 (file)
@@ -5438,7 +5438,6 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
                                    struct smb2_query_info_req *req,
                                    struct smb2_query_info_rsp *rsp)
 {
-       struct ksmbd_session *sess = work->sess;
        struct ksmbd_conn *conn = work->conn;
        struct ksmbd_share_config *share = work->tcon->share_conf;
        int fsinfoclass = 0;
@@ -5568,10 +5567,11 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
 
                info = (struct object_id_info *)(rsp->Buffer);
 
-               if (!user_guest(sess->user))
-                       memcpy(info->objid, user_passkey(sess->user), 16);
+               if (path.mnt->mnt_sb->s_uuid_len == 16)
+                       memcpy(info->objid, path.mnt->mnt_sb->s_uuid.b,
+                                       path.mnt->mnt_sb->s_uuid_len);
                else
-                       memset(info->objid, 0, 16);
+                       memcpy(info->objid, &stfs.f_fsid, sizeof(stfs.f_fsid));
 
                info->extended_info.magic = cpu_to_le32(EXTENDED_INFO_MAGIC);
                info->extended_info.version = cpu_to_le32(1);