Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5094423pxb; Tue, 28 Sep 2021 10:23:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyox3gw7xYy3GbbwM3XL5ZXB10/exPjD/oWxt6ke/krK0sj0N1pWPTK34lkMRFXa50t/UBy X-Received: by 2002:a62:cf02:0:b0:447:d4d5:db39 with SMTP id b2-20020a62cf02000000b00447d4d5db39mr6730536pfg.67.1632849810062; Tue, 28 Sep 2021 10:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632849810; cv=none; d=google.com; s=arc-20160816; b=0Ziw4q5aWLLWEu/26FJtvMyZZxr7TOEG5ljMilAcvSGk6EemA5mNaj05U8kCuJkma8 j1LT4vV8att5gzoxq5Bb/Vk8h2VZuqolPP2bmSg7PEDgOwdrrQVpOWcO6i61gbiYF2fI mbVslyiG87JtuCkQURcnX+oSMg3Dq0iV22Co4/K+3w28AW/fuDtsKHYKKnRjJXaNz44B jn4+XYd67aYWHuBh6Jx/Frxfn6Sa+xkEahF4sGOWXaSA4kEL+2K/LQ5x6N88sv610scq l6NYrx04J/m99kytGdj9Cgr+ckQ99e78opKybhRtUccqcnvCkUxRl1YnCiGkw0nGL/vA GNhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=1eIU+Q66pTwxALS54M8jSJ/OOGHF+t7oZXoe1eQzNBY=; b=tWsxsgUU0XZXwy7oE/sJvZ7oRYSkn3AmbbnHij9ABtzm5oXYL8k8r0dBM5muRJJ9IK 9es4H6gU5W/wf+L/Z6ZwggzPkiErU+8Q78/hkrPjI+ksseK+IvtYd0LcH0hrYrNWFJjr yNPupuqViDEuQptmPkp77OQaZ9+MmCh447lij6c3pMTrT8hXCHTDhjW6XcBcLmKydq4p NaHceHwzXAJ0Ux2NYpGkEGjDvEpS9xc9R3zhGR90r1wxxJPDhjcCV+/QmC4IoN0auJIE lVot5+D93VNJJfagvi/idjBboaDqgmuwytf9vZOQ4K0D0WATs9LAZCgPbUSL4up83+nE IYmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="cOLMthE/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oo11si5387311pjb.9.2021.09.28.10.23.13; Tue, 28 Sep 2021 10:23:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="cOLMthE/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242041AbhI1RXi (ORCPT + 99 others); Tue, 28 Sep 2021 13:23:38 -0400 Received: from relaydlg-01.paragon-software.com ([81.5.88.159]:52656 "EHLO relaydlg-01.paragon-software.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbhI1RXh (ORCPT ); Tue, 28 Sep 2021 13:23:37 -0400 Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relaydlg-01.paragon-software.com (Postfix) with ESMTPS id 9D754821D8; Tue, 28 Sep 2021 20:21:56 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1632849716; bh=1eIU+Q66pTwxALS54M8jSJ/OOGHF+t7oZXoe1eQzNBY=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=cOLMthE/1M0+NvB7o1gxTLZ0327Y0jyS0xc5PxAtLfOqie21kiQJBsN5S7s6mC8lo FlKBxHCj5EgTpkbgm+r9vvvvvCBbwUno/lTROUtm2jwSlEO7YzPsHaQvuGFnXpBheM X9L3Y8Gu0Cw0PQbsBRH2cATbrR/5ePS25Xjenma8= Received: from [192.168.211.85] (192.168.211.85) 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.2176.2; Tue, 28 Sep 2021 20:21:55 +0300 Message-ID: Date: Tue, 28 Sep 2021 20:21:54 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH 2/3] fs/ntfs3: Reject mount if boot's cluster size < media sector size Content-Language: en-US To: Kari Argillander CC: , , References: <16cbff75-f705-37cb-ad3f-43d433352f6b@paragon-software.com> <6036b141-56e2-0d08-b9ff-641c3451f45a@paragon-software.com> <20210927185621.2wkznecc4jndja6b@kari-VirtualBox> From: Konstantin Komarov In-Reply-To: <20210927185621.2wkznecc4jndja6b@kari-VirtualBox> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.85] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27.09.2021 21:56, Kari Argillander wrote: > On Mon, Sep 27, 2021 at 06:48:00PM +0300, Konstantin Komarov wrote: >> If we continue to work in this case, then we can corrupt fs. >> > > Should have fixes tag. > The bug is in initial commit. Do I need to write Fixes: 82cae269cfa95 "fs/ntfs3: Add initialization of super block" ? >> Signed-off-by: Konstantin Komarov >> --- >> fs/ntfs3/super.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c >> index 7099d9b1f3aa..193f9a98f6ab 100644 >> --- a/fs/ntfs3/super.c >> +++ b/fs/ntfs3/super.c >> @@ -763,9 +763,14 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size, >> sbi->mft.lbo = mlcn << sbi->cluster_bits; >> sbi->mft.lbo2 = mlcn2 << sbi->cluster_bits; >> >> + /* Compare boot's cluster and sector. */ > > Pretty random obvious comment and I do not know what this does in this > patch. > >> if (sbi->cluster_size < sbi->sector_size) >> goto out; >> >> + /* Compare boot's cluster and media sector. */ >> + if (sbi->cluster_size < sector_size) >> + goto out; /* No way to use ntfs_get_block in this case. */ > > Usually comment should not go after line. If you take chunk from patch > 3/3 then this is not issue. > >> + >> sbi->cluster_mask = sbi->cluster_size - 1; >> sbi->cluster_mask_inv = ~(u64)sbi->cluster_mask; >> sbi->record_size = record_size = boot->record_size < 0 >> -- >> 2.33.0 >> >> >>