Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BFE04D90B8; Tue, 21 Jul 2026 21:02:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784667723; cv=none; b=eZW92hig8ukdjagcsfZfV9oRmTsIfVV+zHjPl2JGiCZnmYv4OikqA77KF0DVZdwGTDLXIuUUDnynivens7O00ayedsG+MTwPnarIix1TfHN36vounCCl/vwsNqIP5G1qH0cJCtSKKfxkNZrH1gfkCButZ6fZUmB0+1SuyqDvlnM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784667723; c=relaxed/simple; bh=b4WB4yGQX+KfSts9COXVNew8WDXINiwH0wDQFn3seoQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ibyB/0Vh4mxlVJSi/XPYktGH5PxksFzqGptfBjjT+G94aRtppI4J9heCtunMR1DguFeUdYHZPU7EV8jjYuXRbSIw4STTPNyHbbstlbuCoSmdWGan6MNsuoOP+7yykCLl0v8NvLIshu5/NZKPao3eczWaXhmSxM81U8aBdo0tO0g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mlCFqI8T; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mlCFqI8T" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA40C1F000E9; Tue, 21 Jul 2026 21:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784667721; bh=7FsY4I82zDDVz1LVlf3ZfzgRtorkdeZI7rVwuaFF4Ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mlCFqI8TII+mNfd/kqkBfbeqJ6eY3hlY5t47D/5HCxlISI6C0GWemhfb6mIczJHgt J6inDvVmEF0Zfij0BHtzh/qYV56ZIxCXw8qN5Y5kS77wVaxPwFn2urjyRWMXckOJq4 aiZqN1dp3kNdJj68tDvBdsIJ4I1tH0n0rg00kUUE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Rafael J. Wysocki" , Hans de Goede , Andy Shevchenko , Sasha Levin Subject: [PATCH 6.6 1151/1266] ACPI: driver: Check ACPI_COMPANION() against NULL during probe Date: Tue, 21 Jul 2026 17:26:28 +0200 Message-ID: <20260721152507.538007048@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Rafael J. Wysocki" [ Upstream commit e4865a56d013e86e46ea6acea15bb6eae01898ff ] Since every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), platform drivers that rely on the existence of a device's ACPI companion object should verify its presence. Accordingly, add requisite ACPI_COMPANION() or ACPI_HANDLE() checks against NULL to 13 platform drivers handling core ACPI devices. Also change the value returned by the ACPI thermal zone driver when the device's ACPI companion is not present to -ENODEV for consistency with the other drivers. Signed-off-by: Rafael J. Wysocki Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko Link: https://patch.msgid.link/4516068.ejJDZkT8p0@rafael.j.wysocki Cc: 7.0+ # 7.0+ Stable-dep-of: 18a00ed0e718 ("ACPI: NFIT: core: Fix possible deadlock and missing notifications") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/acpi_tad.c | 6 +++++- drivers/acpi/pfr_telemetry.c | 6 +++++- drivers/acpi/pfr_update.c | 6 +++++- drivers/acpi/thermal.c | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) --- a/drivers/acpi/acpi_tad.c +++ b/drivers/acpi/acpi_tad.c @@ -588,12 +588,16 @@ static int acpi_tad_remove(struct platfo static int acpi_tad_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - acpi_handle handle = ACPI_HANDLE(dev); struct acpi_tad_driver_data *dd; + acpi_handle handle; acpi_status status; unsigned long long caps; int ret; + handle = ACPI_HANDLE(dev); + if (!handle) + return -ENODEV; + ret = acpi_install_cmos_rtc_space_handler(handle); if (ret < 0) { dev_info(dev, "Unable to install space handler\n"); --- a/drivers/acpi/pfr_telemetry.c +++ b/drivers/acpi/pfr_telemetry.c @@ -365,10 +365,14 @@ static void pfrt_log_put_idx(void *data) static int acpi_pfrt_log_probe(struct platform_device *pdev) { - acpi_handle handle = ACPI_HANDLE(&pdev->dev); struct pfrt_log_device *pfrt_log_dev; + acpi_handle handle; int ret; + handle = ACPI_HANDLE(&pdev->dev); + if (!handle) + return -ENODEV; + if (!acpi_has_method(handle, "_DSM")) { dev_dbg(&pdev->dev, "Missing _DSM\n"); return -ENODEV; --- a/drivers/acpi/pfr_update.c +++ b/drivers/acpi/pfr_update.c @@ -507,10 +507,14 @@ static void pfru_put_idx(void *data) static int acpi_pfru_probe(struct platform_device *pdev) { - acpi_handle handle = ACPI_HANDLE(&pdev->dev); struct pfru_device *pfru_dev; + acpi_handle handle; int ret; + handle = ACPI_HANDLE(&pdev->dev); + if (!handle) + return -ENODEV; + if (!acpi_has_method(handle, "_DSM")) { dev_dbg(&pdev->dev, "Missing _DSM\n"); return -ENODEV; --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -926,7 +926,7 @@ static int acpi_thermal_add(struct acpi_ int result; if (!device) - return -EINVAL; + return -ENODEV; tz = kzalloc(sizeof(struct acpi_thermal), GFP_KERNEL); if (!tz)