From mboxrd@z Thu Jan 1 00:00:00 1970 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 ADF6233F59A; Sat, 12 Sep 2026 12:14:05 +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=1789215246; cv=none; b=XF0+hkHaeYOlO0a34m24tqjdPjvsqacML0oejh85l6q+eOTbr9YePKs7J0wYsQCw4EMlIPXD0sSRwCUS8yDSkig5xDKRDBJc+19wLdXlhfaLN6EkWmzbKKFHc5x+4IJ7l9kCBR13BTvWpelqMDJh+8ayl6763qjsYF/nM8n6Ylw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789215246; c=relaxed/simple; bh=wblG8YDX0mB6eAsYGwbQRfpWA/m33/4j2Uca2hRsSoI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y3OGqBvsdeD5P0rq14F3jnflgHDaARV5+uzBS6tG3BxYcwin1VWJsiaLY0a9kMdHbEtPExqWQXKRWlul/LrK4VTInZnr22fNMSc+1Bb6DLD7Sm2e3gmIj+F+0grRg0L9p5mCa4CiGz8+ehhfZnwgzfIb7b8AbquwmbvAoEeVJBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PEWdZ2qN; 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="PEWdZ2qN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C2DE1F000FF; Sat, 12 Sep 2026 12:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789215245; bh=xEciLhIvGsVJxNjhoIUfcyeKjcaVL6F83B+o858heZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PEWdZ2qNvcVRDLrYokph4/IuU6zOyv3bR01LrgXFXdyWBShG5CiMwKjGjWZ/ACqhD FoYv7bCOpRR/wxSsOBQmjQkJdwIPhLlo2ckQZ/MgZuaxx8odr55rcU+O8R0AyUfcNK kp+jPKiW9ILxF+YzoBcmhrzXzcjGMtN+AcppFgOU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Linmao Li , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.12 0492/1376] platform/surface: acpi-notify: Check ACPI companion before use Date: Sat, 12 Sep 2026 08:48:38 +0200 Message-ID: <20260912065618.504350968@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linmao Li [ Upstream commit 2b3a5dabe89e330413af403246b648c1890f368f ] 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. san_probe() dereferences the result of ACPI_COMPANION() when installing the GSBUS address space handler, so force-binding the driver to a device without an ACPI companion leads to a NULL pointer dereference. The dereference was introduced when the probe function was switched from ACPI_HANDLE() to ACPI_COMPANION(). Check the ACPI companion against NULL and return -ENODEV when it is missing, like commit e4865a56d013 ("ACPI: driver: Check ACPI_COMPANION() against NULL during probe") does for the core ACPI platform drivers. Fixes: a9e10e587304 ("ACPI: scan: Extend acpi_walk_dep_device_list()") Signed-off-by: Linmao Li Link: https://patch.msgid.link/20260706012512.524359-2-lilinmao@kylinos.cn Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin --- drivers/platform/surface/surface_acpi_notify.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/platform/surface/surface_acpi_notify.c b/drivers/platform/surface/surface_acpi_notify.c index 14a9d8a267cbb..7651075572d6e 100644 --- a/drivers/platform/surface/surface_acpi_notify.c +++ b/drivers/platform/surface/surface_acpi_notify.c @@ -777,12 +777,16 @@ static int san_consumer_links_setup(struct platform_device *pdev) static int san_probe(struct platform_device *pdev) { - struct acpi_device *san = ACPI_COMPANION(&pdev->dev); struct ssam_controller *ctrl; + struct acpi_device *san; struct san_data *data; acpi_status astatus; int status; + san = ACPI_COMPANION(&pdev->dev); + if (!san) + return -ENODEV; + ctrl = ssam_client_bind(&pdev->dev); if (IS_ERR(ctrl)) return PTR_ERR(ctrl) == -ENODEV ? -EPROBE_DEFER : PTR_ERR(ctrl); -- 2.53.0