Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2411367pxb; Sun, 30 Jan 2022 15:39:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDf5tnXydT10NKPF58RhfMUJxwm2LWw8OmKFP/pBeKqryG3LKblLd2s6FWZGDfEuCMASiU X-Received: by 2002:a17:907:8a1b:: with SMTP id sc27mr6440428ejc.300.1643585996743; Sun, 30 Jan 2022 15:39:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643585996; cv=none; d=google.com; s=arc-20160816; b=nf+MKpgFX3a5IXhCThuB6LS6azkcG68iJ31nqqEjUQMgXCQRfajIQlnQwvCyBKF+4L VGqlYLmWB87OkLjDwkgaDHybDAAFRrwFIpnDvfboUsIUEK4FPoBUhh08KhAa6URdFs5c hyMjt3/eRhBCeaVPMShNXuQiCkTMwEp2cOY0s5gCAdSe7LwtX3mjUlvX89Rd8/zMSGr7 eD5dcamRMa6Pa5hgOYb5p5WuQQue1b6qUf0cTdLOLKUJRws0bgJ/bYUeQKXG6WFsyid8 0AsAZA7fCADkziQ6/pkN/+ImqC87ACIg7fQwMOIEU9EEajdEyWUOCwEbcrdnoarlrZWO WREA== 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=nzF2oLs85WVSYcgkgSVCsoQ9ZfZM+OohUB+0OcVMZ2Q=; b=ho9LUYO2WE0MEdkhPr05VKB9cFYDHbt2mtmUUrs6a/JEdb09iQmoS0Vx832iUVMSh5 CW0hK8hWXRtV++8fJr8/HT2K/0+Qwwmi2s8+npF8B8GttTIHS0EZuysnZ7+aESe2zPGv cQckgVGFEPzmGcrxgmHdp+NHt6Fjy5qUrWFc5UpCaXV8oddUPJTHo+MI3XxpaZnMZ+4/ Ly31vC6E4fZ9BEL/iXtc3UaUmdq//2il8JwiuiHbQ3m8UdGZkpblyUhNPodxHfDC5fAy OavGLCUk4wJmRc1LvHPVRZdDEQM+Hpzr8lpmWe5+/Si+ZspHouyubbg9cwlt5xZhPCjB +Npw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mwzHz0bC; 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 di2si7766626ejc.62.2022.01.30.15.39.23; Sun, 30 Jan 2022 15:39:56 -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=mwzHz0bC; 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 S1347858AbiA1KSc (ORCPT + 99 others); Fri, 28 Jan 2022 05:18:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347467AbiA1KSH (ORCPT ); Fri, 28 Jan 2022 05:18:07 -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 5FCD3C06173B; Fri, 28 Jan 2022 02:18:07 -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 F2ED661E48; Fri, 28 Jan 2022 10:18:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B43D4C340E0; Fri, 28 Jan 2022 10:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643365086; bh=FpyUHmjkG6laiyj9unPeqvCUaLot+5PMgUU2jkkgb6U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mwzHz0bC/pNzofos1H7lO3sobNhSNKjXt90GM/nfKZvB/nva9WZNGOC8lSxyqcuVQ 76XULi2NupYz3aq+8GkUDzbV5onjlAPK1vJNgvmxHHJGTqI1XPnqDuSOvF3Mdlnxuw Q1zCdlFuoAeRWnIXWjYTKdZsN8YlI49y6zEU7FvM= Date: Fri, 28 Jan 2022 11:17:57 +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_override() Message-ID: References: <20220124164251.52466-1-zhou1615@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220124164251.52466-1-zhou1615@umn.edu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 12:42:51AM +0800, Zhou Qingyang wrote: > In acpi_table_initrd_override(), 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 | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c > index 0741a4933f62..8b10c192ed32 100644 > --- a/drivers/acpi/tables.c > +++ b/drivers/acpi/tables.c > @@ -696,6 +696,10 @@ acpi_table_initrd_override(struct acpi_table_header *existing_table, > 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 AE_NO_MEMORY; > + } > + > 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.