Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2412079pxb; Sun, 30 Jan 2022 15:41:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNUSsEeAMXC2L5ENbeDKhn2FJlTm3ip/VsqrnFTecGHmuX7MOgAtWvkrq/OJ4W3W+QPAB3 X-Received: by 2002:a17:906:4a05:: with SMTP id w5mr15119780eju.479.1643585997960; Sun, 30 Jan 2022 15:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643585997; cv=none; d=google.com; s=arc-20160816; b=jNcnEqXM9zsFxj+XL0CM5uxz7eZxBjZ+SthIhb6wgRJoQJk1GqbITxzvzYtkYOj6bp BtKMI/4FeuSy3CiHVyt5cSOipJNf+IQoBu2OFc+o1Eq8kICycRVJbZuD+ksCylkeBwk5 Kb5cfCNHowSHD1xJsSeyfY4EoYDvqKwwgDEkU0A6gW4mqYNvoeGm1LZEqmreDVAdCP6H OkrznP14K67QyJhcP9Ga5y7pPvfyiYSHGbgsxbDZaefZmlC2XJcgYYeYfr3av2lsA4Z+ QdhQ7Vns9kMkjL7s2bu3VLON6rfaUCqDBhRQMWv5+Gt/5WguANVl6L2uygHHmEaj2sEu ZBAw== 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=t9P4pSolEYqZfwKwFyAbXE3sD4qhs3e0kmWcLo7aZs8=; b=juDrZBxtDqOi26ERxkHOgFdQaoZZ8t3C1Hwnx2/aAxfcFBKghABLfT9MOd0WBwNxGZ blg8u3AdbBVQXsNwtnOyr2vbU5weteqjOzabe8U5k94V/ImvNkKAhCWSUdOXIyTy15rX g2BBKVhv8xpmqRfhON13CDm22JRHL+hPHBMSQdkOAZCTEcyNtU2fE5liHI11j4pXpfRU yZ1MI49p1iripPAoESp7MYr2ZHXcFNxK2FXiKIyTUfIGc1Tg0ag/7dRCoJphdNd4tNY/ AYJ2OYQwSjWi3S5HHgqU3xCh7suQN2LvTdIygt/dzsz7kW0n7UkvxtBGmfVc8jJIAQUR XGzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S+UL3qLD; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nb8si8116774ejc.721.2022.01.30.15.39.23; Sun, 30 Jan 2022 15:39:57 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=S+UL3qLD; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345431AbiA1KQx (ORCPT + 99 others); Fri, 28 Jan 2022 05:16:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345222AbiA1KQd (ORCPT ); Fri, 28 Jan 2022 05:16:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC29DC06173B; Fri, 28 Jan 2022 02:16:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A3D961E42; Fri, 28 Jan 2022 10:16:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31303C340E0; Fri, 28 Jan 2022 10:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643364991; bh=SdPKmEnmM0CRDCsCCY/+aT80UNjClz/1XN601yeRvQo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=S+UL3qLDBBKDcpXehvau/ebbx2Qvcb1ehT0EJXiPMaZI73cvRpr52892n/6WHFg9J /bTdvWnHriKEkCpxs2YwTXUNYihpD45yuZ8iJHGJJJv0Grg04lhzXTdedPWO0UWbJx 6Ip3oxporJbv5Z9zW+iJlTiR5atdxMKhb9U3hR44= Date: Fri, 28 Jan 2022 11:16:28 +0100 From: Greg KH To: Zhou Qingyang Cc: kjlu@umn.edu, "Rafael J. Wysocki" , Len Brown , Lv Zheng , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ACPI / tables: Fix a NULL pointer dereference in acpi_table_initrd_scan() Message-ID: References: <20220124170237.57718-1-zhou1615@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220124170237.57718-1-zhou1615@umn.edu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 01:02:37AM +0800, Zhou Qingyang wrote: > In acpi_table_initrd_scan(), the return value of acpi_os_map_memory() > is assigned to table and there is a dereference of it after that. > acpi_os_map_memory() will return NULL on failure, which may lead to NULL > pointer dereference. > > Fix this bug by adding a NULL check of table. > > This bug was found by a static analyzer. > > Builds with 'make allyesconfig' show no new warnings, > and our static analyzer no longer warns about this code. > > Fixes: 5ae74f2cc2f1 ("ACPI / tables: Move table override mechanisms to tables.c") > Signed-off-by: Zhou Qingyang > --- > The analysis employs differential checking to identify inconsistent > security operations (e.g., checks or kfrees) between two code paths > and confirms that the inconsistent operations are not recovered in the > current function or the callers, so they constitute bugs. > > Note that, as a bug found by static analysis, it can be a false > positive or hard to trigger. Multiple researchers have cross-reviewed > the bug. > > drivers/acpi/tables.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c > index 8b10c192ed32..356e08c4015b 100644 > --- a/drivers/acpi/tables.c > +++ b/drivers/acpi/tables.c > @@ -755,6 +755,9 @@ static void __init acpi_table_initrd_scan(void) > while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) { > table = acpi_os_map_memory(acpi_tables_addr + table_offset, > ACPI_HEADER_SIZE); > + if (!table) > + return; > + > if (table_offset + table->length > all_tables_size) { > acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); > WARN_ON(1); > -- > 2.25.1 > As stated before, umn.edu is still not allowed to contribute to the Linux kernel. Please work with your administration to resolve this issue.