Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp999579lqt; Fri, 7 Jun 2024 05:27:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkhtZ7QRoc9rpxZgwd9pnNP3ib5EEwjx6t8NQMN0O/ZM5FhI4CwYPNxD6m7a4hx03g0kEebNJFn/zVAFTz5z8tBdfiAvbiRG00bqrYRg== X-Google-Smtp-Source: AGHT+IGGQrXwQUY9dUyHYFR3G6CpXvAsAhf2mZ7AnQboKavfun5jOfNo367NaiXSztOXyH8TooMh X-Received: by 2002:ac2:4d06:0:b0:52b:962f:a82b with SMTP id 2adb3069b0e04-52bb9fd9697mr1728873e87.66.1717763262327; Fri, 07 Jun 2024 05:27:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717763262; cv=pass; d=google.com; s=arc-20160816; b=O6z2ilYdCelJoeCqB1fEo1vf+W20HTvNugJ09ez/XfOk6XJep0dhkmoZYl/Gl3rwaR Oc6vHU3ITbs7XpAi7OFhRlovT1c1idDTSBjb6w6lpvBCbCe9MuIUsDqFH1+piIBFpYm2 teq75Z3PTBBUuw4NXiWx/X8au82xN51VRioCEpyR29LcX6aP1EH/6ic6Tq30GvqIwIfb cGS8iEvaL8KUovNjmW521Xp4CV+vqbyUGAeY9gTdOdkyGBmg8Oi+0a2ksRRzAbYsCFcy 2xEUYP0j8SlZu/6oKAJBUVXIz4+tnpyrO7cpUGgBU/9XJpYgYa4SpjepPDQ60nu/4L6R jWfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hZDgLEF+W6zZWxUzPUdboblkLRtxbcKk/oAVZILB+e4=; fh=xoZo938iZo6Zo9BQRi1y1Y/2pdszedQYQQiMhZQzvOk=; b=dpqBw+sLEwI7tManT/17B6zN01rtGkHV3XPoAX3xD9Oujdpf8kYRaE6PaYaX9hlqZg eY4AJIZukSYonp8XMC396uUElGCd/5ITHhJYQdiaLBm2rzMVM4plVCXGYjfaIbqHuac1 dh3XcLZk9rbZPDz+Pawp/hiRhS0W2ZlQtdgFv5nL5kkQoQm0DfB8tfiOhLIh12wZtML1 q1M4lx+i0HrnVojiPMiBEpUw/SFNu5p9Uovg4aJTagxjw7vdNApfnfbiVTafgE2XY6sO YiBohbhQhZeZXKzvQe9JiwFi7E3r4l/Ow4wI+VpRummIRFr1wK0BzN144xpK8u0cnQd+ h72g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=MhmQO+3w; arc=pass (i=1 spf=pass spfdomain=paragon-software.com dkim=pass dkdomain=paragon-software.com dmarc=pass fromdomain=paragon-software.com); spf=pass (google.com: domain of linux-kernel+bounces-206029-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206029-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c8058e780si180972666b.65.2024.06.07.05.27.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 05:27:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206029-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=MhmQO+3w; arc=pass (i=1 spf=pass spfdomain=paragon-software.com dkim=pass dkdomain=paragon-software.com dmarc=pass fromdomain=paragon-software.com); spf=pass (google.com: domain of linux-kernel+bounces-206029-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206029-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 06F491F26DA7 for ; Fri, 7 Jun 2024 12:27:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F082A194093; Fri, 7 Jun 2024 12:26:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="MhmQO+3w" Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DAB2190682; Fri, 7 Jun 2024 12:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717763178; cv=none; b=nMtCrsxRQWGX3d69VBmLp/KazkfxaaYyYZjHowuwfDIvWvYKVSnPg1RVw0DRDAG6AtFywId9vXfO6K/lzQO4qbDmoZiXQDmXZ8IcSpJDLF197rEI41pZjRW/vHCIbHi6BppKhY6KwclaHO3PHzgvdmssQj0VdRv2l/LzCnV3nuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717763178; c=relaxed/simple; bh=9pfPn1DGlgCPQSm1l68MBIhjL6uK0pKgf2XzkNTt120=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lAtFbqMaZhyPQKyKQ9hv/YxM8CB11aD52xzsfH/Lfx9K7FEogkK7S6BR7KUxac/O57UjMavBsWfeX6tY527yOJwytG8TC9DixvA+TT5qd9y7aGjLlPuZyUZlue4Ohc8t8NN1OfvfBGXbvxiuwrzm5fAaDZqxgwWKxMOJIFtvdqk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=MhmQO+3w; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 123A72110; Fri, 7 Jun 2024 12:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1717762095; bh=hZDgLEF+W6zZWxUzPUdboblkLRtxbcKk/oAVZILB+e4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MhmQO+3wsHnK5Fg3xzRJt2k9tQH70q/hOnKV5CFtagm4ISB+eVWwYbFLKQiM+aYYn qAswQYHDqS4nrCIYol8JFPNmukVUr4Sycyyr0DWh6tkF+JjCgx4KSneWqlseE/mh7q cUOOhllUs0kF7prHBXYcMk9A0UYoJttTqsZ2G6sQ= Received: from ntfs3vm.paragon-software.com (192.168.211.95) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 7 Jun 2024 15:16:08 +0300 From: Konstantin Komarov To: CC: , , Konstantin Komarov Subject: [PATCH 04/18] fs/ntfs3: Deny getting attr data block in compressed frame Date: Fri, 7 Jun 2024 15:15:34 +0300 Message-ID: <20240607121548.18818-5-almaz.alexandrovich@paragon-software.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> References: <20240607121548.18818-1-almaz.alexandrovich@paragon-software.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) 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 --- fs/ntfs3/attrib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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) -- 2.34.1