Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5123705pxb; Tue, 28 Sep 2021 11:01:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtucTzF5bi/R7fog2EOXbAN5Cy8CpB6dKwtyyPwQcUJEakTUcCoB44nahDryUUjWcAiKPI X-Received: by 2002:a17:90a:c682:: with SMTP id n2mr1267911pjt.163.1632852066457; Tue, 28 Sep 2021 11:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632852066; cv=none; d=google.com; s=arc-20160816; b=w/O7iImna6CIvwqgwP5/TuUzlHU6GRAAuRsF0XQI1dRZQpf+i+sPT5on5mO09UFs+y 3DQDVHKc+vknl/H0vx5c3Vi2NxFynB6xH1LLIXfCW7lNrYOQoHj0JgaAOsOaQf+ldrZl hZ5ujkc05SNgAsJtB3L1Fh2nSpVm8GpOORp76X3vtQfCB9GZvh8GPije3PT+6IIKCs6V BIbOVJW1XrOXEb8OZzCoNE99P27KEtcxCI+X88iSvKbpxjGWqOj4ro2qz/eWci/SUJlN BINO6dF3VPxCCbKuSXaF21kQOmTDaHEGIgkhZN7R9azMcTQTujbMJFf0fCGY+Pc05SkT WbDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=68p1tAQ5Jz/+Bnsf/d8ssuN60AfPupdQ5Ex9JLDoD9Q=; b=V5oDCRWn06z+VnjMHYfEFr/jEaWq4zTnTYH6vjD3w4jNNSZyj9PRXIAZyd2BFZH+Oh k3nmDbropTayv+66lmYspNYX99ppESoF5XfWIX1DV0JUqq9TJd9UmePJQBj6+lGlb1H9 DioKnvJf8fOQnHS1G1NXBofAin3QHhrwqBdPnqUQJec/bXJbpfJsQe/h4OrzmAyD4nzE nCxC0742goZ/v+b2o6b1GLIiXahK4XHOoRH15mn6icp2LBZMCZcx21P4uiLlozR2gBzu 0D8E/DTgx7/6QcCSSM//XwzylztgsuqzDHuz57TQHrlH10WY98ZivOlnUIT4N61Ui0bk 1bNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hfaJWJij; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n3si26996586pgv.117.2021.09.28.11.00.52; Tue, 28 Sep 2021 11:01:06 -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=@gmail.com header.s=20210112 header.b=hfaJWJij; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242103AbhI1SAa (ORCPT + 99 others); Tue, 28 Sep 2021 14:00:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230238AbhI1SA3 (ORCPT ); Tue, 28 Sep 2021 14:00:29 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53512C06161C; Tue, 28 Sep 2021 10:58:49 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id u18so94115541lfd.12; Tue, 28 Sep 2021 10:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=68p1tAQ5Jz/+Bnsf/d8ssuN60AfPupdQ5Ex9JLDoD9Q=; b=hfaJWJijWESeyx+nfAyg/5CUbQMOg6oC23UpLWwtplLtdufQsotDCaAJycNtLSaffX YjxDeqXVAQy5as4OgYiRYi10ftKa6jjAkTdZ/Abs64cZYU0EPbo91KF4DZ8ZJBXkgop5 kpWEBBL+HEAr0STVxrnOdWSU2tBr8D0ck5o7fjE0bAoIzP9vIv0ttESrEpVccQD3VVVq E90TES/koWKD2cSkSK54w1qC6G0zBmsCgbSSkWfBaN9RAqf4YxYkWRKstuQQ5vnV2n3z qYL45vzUUzXjse7/XHATX0G3f6mAkUZrfVhUpdTjXtY+zXXjEFV4qA9OBR/G/nUI5Ydx v0mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=68p1tAQ5Jz/+Bnsf/d8ssuN60AfPupdQ5Ex9JLDoD9Q=; b=WWZ4cX204uuBeJAFN2e2ApYvNVvihOApuN0gX4TX8QIO8bbtmW5F/LyASvGUq6gSeY uTuNa54VZapFsuCE1LlfL6eU762R5XTK2vQwKl7K3NaGfnh1FDBQ5Jq8vEVIC5NpjcZK h6DZOulNwBp7hHidNx70V/Wrl6X8sQMUXlKG3jmrSKrQiU/rwJEjVf9qjDcXen72flhU 1az7TGUVQSJ7lsov3O13G8YxgRn204oj9NLRYzvxGJp/axWEWMGUW8ZlkG6Ig1cZ0LvJ xc4KZXn5VyXF+ogXH6ijYVi8R0iApNqx2DbFea0FML7NH4Ys0HOn4+J/aGCkTzMETSLf RmuQ== X-Gm-Message-State: AOAM531VNepvadP52WfJOIB9XsgmrlVT2H16VSU3f7Irvr08w5zv8TSs y/OejOyIWI7Kq2sr9eo+xtvkDkXT+tg= X-Received: by 2002:a05:651c:178e:: with SMTP id bn14mr1339716ljb.521.1632851927694; Tue, 28 Sep 2021 10:58:47 -0700 (PDT) Received: from kari-VirtualBox (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id j11sm1983386lfu.33.2021.09.28.10.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 10:58:47 -0700 (PDT) Date: Tue, 28 Sep 2021 20:58:45 +0300 From: Kari Argillander To: Konstantin Komarov Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 2/3] fs/ntfs3: Reject mount if boot's cluster size < media sector size Message-ID: <20210928175845.ytqj4o4m2e5bsfrr@kari-VirtualBox> References: <16cbff75-f705-37cb-ad3f-43d433352f6b@paragon-software.com> <6036b141-56e2-0d08-b9ff-641c3451f45a@paragon-software.com> <20210927185621.2wkznecc4jndja6b@kari-VirtualBox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 28, 2021 at 08:21:54PM +0300, Konstantin Komarov wrote: > > > 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" > ? Yes, but format is not right. It needs to be 12 letter sha and need brackets. Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Just add these to your gitconfig [core] abbrev = 12 [pretty] fixes = Fixes: %h (\"%s\") And after that you can use git show -s --pretty=fixes You can see also that others have used this same fixes line in commits: b8155e95de38 ("fs/ntfs3: Fix error handling in indx_insert_into_root()") 8c83a4851da1 ("fs/ntfs3: Potential NULL dereference in hdr_find_split()") 04810f000afd ("fs/ntfs3: Fix error code in indx_add_allocate()") 1263eddfea99 ("fs/ntfs3: Remove unused including ") 8c01308b6d6b ("fs/ntfs3: Remove unused variable cnt in ntfs_security_init()") 71eeb6ace80b ("fs/ntfs3: Fix integer overflow in multiplication") The reason for fixes tag is that automatic tools can more easily cherry-pick things. Kernel stable branches example big these automatically, but there is also other companys which big these. Also it is sometimes nice to check commit which introduce this bug. Also some organization or study might use these for some statics. > > >> 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 > >> > >> > >>