Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2387132rwb; Mon, 15 Aug 2022 04:42:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR5RoWF8itic0SODMmTipe3J9kqv1isQUEqUzmZjDttnOOBepUatbXwBr6Xn805MbURTWccE X-Received: by 2002:a17:907:8a0a:b0:730:a118:75de with SMTP id sc10-20020a1709078a0a00b00730a11875demr10556159ejc.189.1660563746608; Mon, 15 Aug 2022 04:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660563746; cv=none; d=google.com; s=arc-20160816; b=U1Nu5mpaqHFQmG6zVRULs7PN79GctfOuPyjKdJF9zzhTYqHbgeNtDMG2wNwsxAn9Sj nC6o/O3/30qdDoBWoRm1+Ck+YuD1uMaSm23H8TdB/2I+NJlgw7zt9H4a+pS/Gy93STQI GoshyUTILXOMJg8TSNDWF9YuCn2/DVLX52mfEgvQDIhms52BZy+uuRR7vXbcPoRphmq0 tcE/s4WC1IXnguV2LqTN1PP4G8n9H3WIbn+xRVXvus/KxeeHhSrF8dQpvjTF+Jn3BHw5 lSSO/jnPXlqH5Uo+AJU/HAEgNIBh96SocFeZeK/DIVVjAig+5UD+L46ODxEFiGT5HfeZ NsGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=0w9+PjA609EvTdhJ21FdPZXkjOwyQWsh3sVgxJTFZ6o=; b=OFIXqHULM5RSAAyuT7arWJOzAn0cknbafrdXIeWvOnDtlJpNYDZRmoelLEn1UQN6Z+ b1WKSKZYYQIazSXqJf/oHHA6weTB6G4xZafNnW2RTDeN/eXnNISolIoG+JErsfArvNIJ mENiJr9fgDM3CH0X6dYn3PR4YIRuSktap32kx1pt+48T2cjfaCB3YmIJU5k6cSvLXB0c rwo0HszWGoTSzNqKUxL3cKbuls0jgYZ8rrvpPhtkocyL6lDUdPm9gF7fl5Z/5SY4fWlo xG6tiW6lRcqxhZBjcI6hnhoBy77dxyPDn30jY7UVip9SfDAtlICzTnsd2WasaCUxxhWu vw/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mpIQlUx8; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds3-20020a170907724300b00730fdb36019si8795541ejc.21.2022.08.15.04.42.01; Mon, 15 Aug 2022 04:42:26 -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=@gmail.com header.s=20210112 header.b=mpIQlUx8; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232224AbiHOLHd (ORCPT + 99 others); Mon, 15 Aug 2022 07:07:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231297AbiHOLHa (ORCPT ); Mon, 15 Aug 2022 07:07:30 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37AE62624 for ; Mon, 15 Aug 2022 04:07:29 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id l4so8642704wrm.13 for ; Mon, 15 Aug 2022 04:07:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=0w9+PjA609EvTdhJ21FdPZXkjOwyQWsh3sVgxJTFZ6o=; b=mpIQlUx8naMiLfDubLm93ghNfu2hM9q79depVhpdHOHndayUW+ZQqz3R6VCFDtTWaV dqU1RsDPCKbEvO772qY0rFXbU0jSZmMJbIws0Afa9Bxo1bJOaTbAd1pZQSmP5vEOCKsK i/c4Id14Mu91nbCJVk1FfQoyoi+guS86d8/S9yGGmg35o8bhJiUpqZUuxHEuBfJQACw3 jXH9qSKAUvBsYHJ+ZegPDcZAJ7xOQHAKOCHGKEHkNLqSkqIFJF18l7sPDEGolyOMgRnL 52+CvGaw8LTAZt2LjjNWTPFJnJArztIZry18J1ZzHAVhy/Lvp1RYVNs2m7WtFU4iR+f3 NUpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=0w9+PjA609EvTdhJ21FdPZXkjOwyQWsh3sVgxJTFZ6o=; b=QXFyBTtT2cGdVyA5E9SoqVEybafMaA1JM0dexVTITZ4P/gqITI3DBxBry9yZPxTCBl tWN28pXPFwSxpzCkxVVot1H4VjWtqDwO2Cw17+h4JOlRkY9iT5T855DsJvAuYNdB0knD VYspjY8dKIM6H7mJYirvsIhQfNmBn076vt2a2SWexYhyYVS0mL5noPladFH5t1c5NWDX lWVGvxHwaCzZMQ9Ix0qqSBNdVPIV924d9TjonCrZHawsSgegLyrAMrzSgANm/6z+Sftj E/xnbYL/qREzH9Xa7/yno7sPsf/2cBvHc/A33jGzgzCnWiBCoAV6qMqjpvqqgdKJq57T XFtQ== X-Gm-Message-State: ACgBeo0+7QXS+iDGlOHZqesIKRIxg3/KzAFFOx6nhAcXJ81JH6QsuuXU TcinxOMyJrjIC+qZq2eX1FjD/X0uQk3aWQ== X-Received: by 2002:adf:eb50:0:b0:21e:3d13:3a91 with SMTP id u16-20020adfeb50000000b0021e3d133a91mr8213168wrn.484.1660561647708; Mon, 15 Aug 2022 04:07:27 -0700 (PDT) Received: from localhost.localdomain (bzq-233-168-31-62.red.bezeqint.net. [31.168.233.62]) by smtp.gmail.com with ESMTPSA id d2-20020adffbc2000000b002206203ed3dsm6996651wrs.29.2022.08.15.04.07.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 04:07:27 -0700 (PDT) From: Alon Zahavi X-Google-Original-From: Alon Zahavi , Tal Lossos Subject: [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference Date: Mon, 15 Aug 2022 14:07:12 +0300 Message-Id: <20220815110712.36982-1-zahavi.alon@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 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) -- 2.25.1