]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fs/ntfs3: Deny getting attr data block in compressed frame
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Mon, 3 Jun 2024 17:07:44 +0000 (20:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Aug 2024 07:00:21 +0000 (09:00 +0200)
[ Upstream commit 69943484b95267c94331cba41e9e64ba7b24f136 ]

Attempting to retrieve an attribute data block in a compressed frame
is ignored.

Fixes: be71b5cba2e64 ("fs/ntfs3: Add attrib operations")
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ntfs3/attrib.c

index 8638248d80d934710e7c3b98abfd80e5bc30cc16..7918ab1a3f354657ad70dab9a00cc129c6f0e5eb 100644 (file)
@@ -975,6 +975,19 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
        if (err)
                goto out;
 
+       /* Check for compressed frame. */
+       err = attr_is_frame_compressed(ni, attr, vcn >> NTFS_LZNT_CUNIT, &hint);
+       if (err)
+               goto out;
+
+       if (hint) {
+               /* if frame is compressed - don't touch it. */
+               *lcn = COMPRESSED_LCN;
+               *len = hint;
+               err = -EOPNOTSUPP;
+               goto out;
+       }
+
        if (!*len) {
                if (run_lookup_entry(run, vcn, lcn, len, NULL)) {
                        if (*lcn != SPARSE_LCN || !new)