From patchwork Fri Jun 9 18:00:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuxuan Luo X-Patchwork-Id: 1793129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=YGoR0l5S; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qd85D729Qz20Wb for ; Sat, 10 Jun 2023 04:00:47 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1q7gPc-0001bM-BV; Fri, 09 Jun 2023 18:00:36 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1q7gPZ-0001aP-RW for kernel-team@lists.ubuntu.com; Fri, 09 Jun 2023 18:00:33 +0000 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 9EBE23F15D for ; Fri, 9 Jun 2023 18:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686333632; bh=nzcPcPeMnJevdF9w29vh6zbFG4gobPYhWYoWeEoauUo=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YGoR0l5SHWRRy6fTPPCiwbN3tASudvd4EAL/AAQzCMmHpyLAf/PmIQOOYmnNriEuY OowJta0R8GkQSPExFUchHaqcsuvCLdxc02YbapCxUnV2wF/5Kh+YNz17vFslYWrh5f uukZqx4P5bkf+gsxB13xEw7hmKUXX0FyDt9xZSsNL/1qdhMEm/+9Z/PBIpKCgaJYzP 5WW+LQfhsWWnDX9JP1hynt2irWYMU7llXXbxfV6f3vDAVgudPfp74mk7neLgBL5pOr p73lnl1sX/W4WCid7fBs9WYcnB1raf7BqRFbAQFzH5AZw38HDvqUczIXBr61TcmT42 ZJ6Nj3ngsh9QQ== Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-75d4223b16aso293158485a.0 for ; Fri, 09 Jun 2023 11:00:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686333631; x=1688925631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nzcPcPeMnJevdF9w29vh6zbFG4gobPYhWYoWeEoauUo=; b=Mx7ODY7GdlnSDmu6tdyOWWkTbjRoYwFwBslyo/uHxkdIuIDJf72W6IGynv7gM/GROr NuvOjolts4kcYK0jN2/o3mxRwdEdEyZHmYmQqhXLLVmg4FsFQMaP/uXcLx8Av70iLXuw 7YLUnnnN6LF1jEfrw/xnK4E9J9d+7bxJ4zHQWwJdKkgktoGcaxIrc49ytIEynv8/GpN/ 8WiMXnmSNLOuTO8i5E8b4Qn/ys/WS/+Np3IPl/rlH+RFW0yx0L4WccoQn5PkG7xuBaG3 hgo3WV/wOEUBCEHKgD+Ia78Y2GyJUbrZ5gtOhTd+pONoGsD1qf7qN+XNMROWcMeTFSXT VSIg== X-Gm-Message-State: AC+VfDxKAI+jA5UA8ogp8INg7YfGGgthq908mi6EDZOW/4twnunFHLu1 j1SKxUZ9iMSLomtsJXvdebspKFsznPtVwCs9Fa58d6o/myGEcq8gUdBPVg/+jRlFbej1bA0pW+U D1Y/Spxog6BCIcNwNTE1Ptlzft3LEEnGBf9vqLN3g9K+kgHF6tw== X-Received: by 2002:a05:620a:1a8c:b0:75b:23a0:deb1 with SMTP id bl12-20020a05620a1a8c00b0075b23a0deb1mr2464881qkb.47.1686333631081; Fri, 09 Jun 2023 11:00:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MSezfxrX/6Ww7FHXz1Ew5CTVKAGS17c+UN3D0q3BovxeN7J38XxMB3+C83ixgYnrCNoBK1A== X-Received: by 2002:a05:620a:1a8c:b0:75b:23a0:deb1 with SMTP id bl12-20020a05620a1a8c00b0075b23a0deb1mr2464864qkb.47.1686333630801; Fri, 09 Jun 2023 11:00:30 -0700 (PDT) Received: from cache-ubuntu.hsd1.nj.comcast.net ([2601:86:200:98b0:66a9:7cde:3e23:bf40]) by smtp.gmail.com with ESMTPSA id q26-20020a05620a039a00b0074df476504asm1190238qkm.61.2023.06.09.11.00.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 11:00:30 -0700 (PDT) From: Yuxuan Luo To: kernel-team@lists.ubuntu.com Subject: [SRU][Jammy-OEM-5.17/OEM-6.0][PATCH 1/1] fs/ntfs3: Fix attr_punch_hole() null pointer derenference Date: Fri, 9 Jun 2023 14:00:27 -0400 Message-Id: <20230609180027.41969-2-yuxuan.luo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230609180027.41969-1-yuxuan.luo@canonical.com> References: <20230609180027.41969-1-yuxuan.luo@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" 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 Signed-off-by: Konstantin Komarov (cherry picked from commit 6d5c9e79b726cc473d40e9cb60976dbe8e669624) CVE-2022-4842 Signed-off-by: Yuxuan Luo --- 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 71f870d497ae..59b234046fd6 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -2020,7 +2020,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)