Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3884619rwb; Fri, 30 Sep 2022 09:35:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Kdnq8yKy0dNSklR0pVC65AOM1jL1wDwF70r6CumZHM0SVw11RM5LONYar7K0isoveURYi X-Received: by 2002:a05:6402:5c9:b0:446:fb0:56bb with SMTP id n9-20020a05640205c900b004460fb056bbmr8645593edx.173.1664555700733; Fri, 30 Sep 2022 09:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664555700; cv=none; d=google.com; s=arc-20160816; b=R1CzSUtciRrQQ71l+c48RCwg0sr0AL2Y8vJ54My+yVP8yhvfrqq5i+QEe6/a5uj65S u5mt0CisK6Q6+H6EwMgTHyz2sazTkDyS+RBnDd+LoeGYVE3ODiCgcO0BfMMHa79ZD8We TuRWu/qfPVGj/U12DPpCiyYu+Y/aEQcAqGcm7XUVUxrN0WC4zZdwYEcCWiNVmvSnedeJ 7xA6gBU3ATey2p1lsytraNoR+8rLYQCgwfwqhuRj6cIFXtD7vBODKTwqHxZfbuAtWFZu 6rSi8jSmKsZTT+ATGzK3k6QK+TDMi8S9AcsQLth6pDmYW1wNrGHgdh+Ms2rV6x8FXERy dUhg== 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=fJostlUzc8wpnt0ITxFOMpPuwFxLHZwjaffSJfS8Ld8=; b=zSV7OOsIq5OtFdkZ5sAAJHNbBP6c00lMxlKw4PcN4As00e6TF4MmrQhCmgai1uI9DZ XUhb1H7Eg1Q0VkqOcITKHd7K6EOVUvlQZX69TeGjRi6NgRJILy9htk83M/14vUF3Xp/c oBe6jeAs65x/vi4ION4JwiPKEMUnKR1/jQihLZuaE5hYmcUwjuBVpeqxx+1FAF/Yt1C6 mxwODSk0SwLf8JrNc4OSaN3XQzonLMZgaW2ha00Gh31tS1eAsW0IdzU5IBVlJA8H8n1P BO4V0XWuxLKk5Rd/BDCyXdgVgcElJWh+KZyJAeiWxooa/oEYcTD31dO1C8o7aZD/rCHD ZE/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=nwRRjgni; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020aa7c6c6000000b00454412dc7absi2282264eds.259.2022.09.30.09.34.35; Fri, 30 Sep 2022 09:35:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=nwRRjgni; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230521AbiI3Pog (ORCPT + 99 others); Fri, 30 Sep 2022 11:44:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230309AbiI3Poe (ORCPT ); Fri, 30 Sep 2022 11:44:34 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F1C01E2 for ; Fri, 30 Sep 2022 08:44:32 -0700 (PDT) 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 774B721F9; Fri, 30 Sep 2022 15:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1664552535; bh=fJostlUzc8wpnt0ITxFOMpPuwFxLHZwjaffSJfS8Ld8=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=nwRRjgniLyOXLa3oIo1Ynbk7V9sBJXg+PTfkl/9FgGx9D1U78uzNRmmkSnI/rT/ma PxvEYNIcjn4Z1GRq8iHc3xT8CiMnH71I03gqYA1iHhH2i6EAjGXZBe4JQdcOjlK6P7 v9PfnqNh3dsjdNOcME0c0RX4iyuRPkcsqk93cIME= Received: from [172.30.8.65] (172.30.8.65) 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, 30 Sep 2022 18:44:30 +0300 Message-ID: <784f82c4-de71-b8c3-afd6-468869a369af@paragon-software.com> Date: Fri, 30 Sep 2022 18:44:30 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference Content-Language: en-US To: Alon Zahavi , , CC: Tal Lossos References: <20220815110712.36982-1-zahavi.alon@gmail.com> From: Konstantin Komarov In-Reply-To: <20220815110712.36982-1-zahavi.alon@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [172.30.8.65] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/15/22 14:07, Alon Zahavi wrote: > From: Alon Zahavi > > The bug occours due to a misuse of `attr` variable instead of `attr_b`. > `attr` is being initialized as NULL, then being derenfernced > as `attr->res.data_size`. > > This bug causes a crash of the ntfs3 driver itself, > If compiled directly to the kernel, it crashes the whole system. > > Signed-off-by: Alon Zahavi > Co-developed-by: Tal Lossos > Signed-off-by: Tal Lossos > --- > fs/ntfs3/attrib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c > index e8c00dda42ad..4e74bc8f01ed 100644 > --- a/fs/ntfs3/attrib.c > +++ b/fs/ntfs3/attrib.c > @@ -1949,7 +1949,7 @@ int attr_punch_hole(struct ntfs_inode *ni, u64 vbo, u64 bytes, u32 *frame_size) > return -ENOENT; > > if (!attr_b->non_res) { > - u32 data_size = le32_to_cpu(attr->res.data_size); > + u32 data_size = le32_to_cpu(attr_b->res.data_size); > u32 from, to; > > if (vbo > data_size) Applied, thanks!