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 C716D1C3318; Thu, 28 May 2026 20:29:41 +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=1780000182; cv=none; b=pxRCgIFZPzU/FG/CFrLtgr2DHX+CV1pJITFKUPbbH/66zF49wGqXpPxlzD/no5K8aXLAzpOiGy3gcASolFvvKPqwnTrj1PFhsegB5hMEyNBuL1fGGDHukHRSWbubTAG+f4vGNA/5SjnyItaF93TS+teCdM6X14RNuUQ6RAVOR5g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000182; c=relaxed/simple; bh=T422rUOaAgE/u7VqS6XRjAsPfZqakX0U8DA15XJjR8k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=seI3hE8FIIwPP4VkXm2RsixcV+UTSzqGRwyzqD6UdKu6pvSOf1vSQ/pbql1k0nTVFxX4dSJWQ5AqSyE4lZJHLv9w9TMWannAd0iXnnQdjvCXPEKgIUriMYP/3tpWvRXnHYqY0rfcoCETEt98elAmeoIAB3SQeFTpgyB0RJfXdmo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eHJz306s; 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="eHJz306s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32A941F000E9; Thu, 28 May 2026 20:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780000181; bh=MPuGG2Pf8jl4++Fv4ccv+l8Ak1PfSop0XaFf4pxB8Go=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eHJz306scrsJSVqCVPfnQ45TIpVaSNCqRDxBUq0snljwN8cPclqrGi665C7u5gwel 0VxFoys7LgtV7tqtznT1wMk2I02lfzpKyBgKjL2l4zFcA+pkAIequDcribJ95hZzRc mD0Y0EuUxKCdcj4hjKXR4zjWilqAXZek1wuz/l10= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Rafael J. Wysocki" , Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.18 331/377] platform/x86: adv_swbutton: Check ACPI_HANDLE() against NULL Date: Thu, 28 May 2026 21:49:29 +0200 Message-ID: <20260528194647.995962910@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194638.371537336@linuxfoundation.org> References: <20260528194638.371537336@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rafael J. Wysocki [ Upstream commit e7a9a6ea40e352cd7977f6a8c80bdeadf65ad838 ] 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(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence. Accordingly, add a requisite ACPI_HANDLE() check against NULL to the platform/x86 adv_swbutton driver. Fixes: 3d904005f686 ("platform/x86: add support for Advantech software defined button") Signed-off-by: Rafael J. Wysocki Reviewed-by: Andy Shevchenko Link: https://patch.msgid.link/5115425.31r3eYUQgx@rafael.j.wysocki Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin --- drivers/platform/x86/adv_swbutton.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/adv_swbutton.c b/drivers/platform/x86/adv_swbutton.c index 6fa60f3fc53c0..8f7a26e6de81d 100644 --- a/drivers/platform/x86/adv_swbutton.c +++ b/drivers/platform/x86/adv_swbutton.c @@ -48,10 +48,14 @@ static int adv_swbutton_probe(struct platform_device *device) { struct adv_swbutton *button; struct input_dev *input; - acpi_handle handle = ACPI_HANDLE(&device->dev); + acpi_handle handle; acpi_status status; int error; + handle = ACPI_HANDLE(&device->dev); + if (!handle) + return -ENODEV; + button = devm_kzalloc(&device->dev, sizeof(*button), GFP_KERNEL); if (!button) return -ENOMEM; -- 2.53.0