diff options
author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2024-06-03 20:07:44 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2024-06-07 14:31:07 +0300 |
commit | 69943484b95267c94331cba41e9e64ba7b24f136 (patch) | |
tree | 1be2d3508c25d48cdd759b6c2e521cdebccb54cc | |
parent | 25610ff98d4a34e6a85cbe4fd8671be6b0829f8f (diff) | |
download | linux-69943484b95267c94331cba41e9e64ba7b24f136.tar.xz |
fs/ntfs3: Deny getting attr data block in compressed frame
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>
-rw-r--r-- | fs/ntfs3/attrib.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index 8638248d80d9..7918ab1a3f35 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -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) |