From nobody Tue Sep 29 07:00:32 2026 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92EC542C51A for ; Tue, 11 Aug 2026 09:58:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786442321; cv=none; b=h5RhMi9iTHzafTMaGWaz/nib+lxbDXGkUkK51XcNttUYhHHYab9nwpuVpwPmyHQTREcgyuvZbSkxkPc1bVQ1oqxs/1ppKhVbNSy/+o5vdJxgDPPEqvlLTH75S1HObcox1kb6FVb6e1Xu+HbqaUNWJbefrjlPmFEiicwaUdGiPdk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786442321; c=relaxed/simple; bh=SHJKKXa6Qxl1b1vatYjKpZOHn+aOrWkwm9LDa9rhBCs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AFMWbvHIgty/9kshiwTZuenbkuX4V/fLHYlbfg/7cdmIwir8EH/3V+eFeFl1WPiLSSh9haUN4MsxbknBNafFlEFg6V4Ruw0/vy3bylTlkRHyS2j/6DgQkFtFh3M/bQe2H0C6/lSnzJwxBRBliDi1MrEIprdRk9LxXqYJLfK7vAk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f194.google.com with SMTP id d2e1a72fcca58-8486ac3f347so772795b3a.1 for ; Tue, 11 Aug 2026 02:58:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786442318; x=1787047118; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Z9G16LNyyTi82BYCiJ00/MXPiMBCTYGTmoQ2/cxSgig=; b=Di/YawLavyoxWSzU7BIDGGjgMf5pH1Ad8LV0G/MSOLIej0ODzXZKTU1jDu3sDf+LWU ZdfdvPnxBMKBhNiCSInKnOeOsV+ramO9EKVX2RdMdMzvCg3GBCOly1UAkZh1rjQ/WuFa PfKi1WjRIv7oeu0rzL4IfDIq0NL+8q15cp2LVwqKXdWxQ4vXjSKbz0gKWt1q++JCqdCu Ok6PTl0zIaC1vrHzPxFNSy/FAdmaBYiadXj+RFqRBWaMumRBeWR31C1mgF2L5yNQIWYF ZfiaRtUSIinddx7KZo5K3gq83TpTU28qZxDRULjJth1HKu+ds8+z7rQz/Z50DQ7ROfly w2BQ== X-Forwarded-Encrypted: i=1; AHgh+RrqsFYONWRjO2yiFeHLHrMrnY3SSJtj+xjKK7oWIavc1ihiLn7Pl+8T1ibpRjLUHOMWJ5UJR8tqYN6koV4=@vger.kernel.org X-Gm-Message-State: AOJu0YwkO8czdlrLEUMhp/ZEfC8S83Q1PWKVHL6EWWJT5txCsOWNOIYX VLxZnpF6q+xlw/2RatbMA982BJIPSxChpuIqgWvaYEwg7AmaE7snhg+u X-Gm-Gg: AR+sD13gf6T3oOM8hK2pwdZALyO1FuvOAmCJz1ERmCUf12lXzcSxAVuvDSeD+MO52dm NGwLDHtGlMoZjRV+aA8rGmUEkzyOonDMRnnSbzvZMlLohWP/0zi+LnXxdwCYAscqS1Ye/eh7psY WpdDXHCVW/ui9YFlfPrRUHJ3vEyq7xy/krtwdOpEIbMJySTfTGJsFCUXIE5QpyExcdMZXuBi+4g l1RPm/gpkZ/jpbfbj/SEp0AC/GhYlukeWpYCcqXvnfQq5NpPIdIhmc6v5wtrnEOyDYtWyOJo68G 3gKITeFzCUrhSJP9kLShWYgp9eorRajD2VGdffOi5E+H/P5kxrADYLKcvZ0Gx+rUh5N7XN4ZvSh Q9GbP2VHPGy8ceQ2GJhilGqvhFLpIWrJ5DSlLQ+U3BrNHWFqcfhyKldv17vml+QeyV/RNne4kN1 wvVkWpIPyoFFCXf8j9sDW93wGkMdfTm7ixsmdaDrBklcTRjtcn9NmwsrpYIgrhAhMfe5qFYT3cg cMIXQqZ/g== X-Received: by 2002:a05:6a00:228a:b0:84a:2b96:5986 with SMTP id d2e1a72fcca58-84fa889d2b7mr1889004b3a.8.1786442317744; Tue, 11 Aug 2026 02:58:37 -0700 (PDT) Received: from kylin-XiaoXinPro-16-AHP9.. ([116.128.244.171]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cbed970200fsm661840a12.7.2026.08.11.02.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 02:58:37 -0700 (PDT) From: Xueqin Luo To: heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org Cc: pooja.katiyar@intel.com, johan@kernel.org, pmenzel@molgen.mpg.de, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Xueqin Luo , stable@vger.kernel.org Subject: [PATCH v2] usb: typec: ucsi: Add ACPI_COMPANION() NULL check in ucsi_acpi_probe Date: Tue, 11 Aug 2026 17:58:27 +0800 Message-ID: <20260811095827.1001654-1-luoxueqin@kylinos.cn> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add NULL check for ACPI_COMPANION() in ucsi_acpi_probe() to prevent NULL pointer dereference when driver_override matches a device without ACPI companion. 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(), the ACPI_COMPANION() may return NULL, leading to a NULL pointer dereference at adev->dep_unmet. Test steps: $ sudo modprobe ucsi_acpi $ echo ucsi_acpi | sudo tee /sys/bus/platform/devices/alarmtimer.0.auto/d= river_override $ echo alarmtimer.0.auto | sudo tee /sys/bus/platform/drivers/alarmtimer/= unbind $ echo alarmtimer.0.auto | sudo tee /sys/bus/platform/drivers/ucsi_acpi/b= ind which triggered the following crash: [ 6599.180948] calling ucsi_acpi_platform_driver_init+0x0/0xff0 [ucsi_ac= pi] @ 24208 [ 6599.181198] initcall ucsi_acpi_platform_driver_init+0x0/0xff0 [ucsi_ac= pi] returned 0 after 207 usecs [ 6729.051074] BUG: kernel NULL pointer dereference, address: 00000000000= 005f4 [ 6729.051102] #PF: supervisor read access in kernel mode [ 6729.051113] #PF: error_code(0x0000) - not-present page [ 6729.051122] PGD 0 P4D 0 [ 6729.051136] Oops: 0000 [#1] PREEMPT SMP NOPTI .... [ 6729.051300] PKRU: 55555554 [ 6729.051306] Call Trace: [ 6729.051314] [ 6729.051327] platform_probe+0x41/0xa0 [ 6729.051348] really_probe+0x1a9/0x410 [ 6729.051364] __driver_probe_device+0xc9/0x170 [ 6729.051377] device_driver_attach+0x46/0xb0 [ 6729.051390] bind_store+0x77/0xd0 Fixes: 1f3546ff3f0a ("usb: typec: ucsi: acpi: Check the _DEP dependencies") Signed-off-by: Xueqin Luo Cc: stable@vger.kernel.org --- drivers/usb/typec/ucsi/ucsi_acpi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/uc= si_acpi.c index 18286d3e9cc5..b4a783217dc6 100644 --- a/drivers/usb/typec/ucsi/ucsi_acpi.c +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c @@ -188,7 +188,7 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 ev= ent, void *data) =20 static int ucsi_acpi_probe(struct platform_device *pdev) { - struct acpi_device *adev =3D ACPI_COMPANION(&pdev->dev); + struct acpi_device *adev; const struct ucsi_operations *ops =3D &ucsi_acpi_ops; const struct dmi_system_id *id; struct ucsi_acpi *ua; @@ -196,6 +196,10 @@ static int ucsi_acpi_probe(struct platform_device *pde= v) acpi_status status; int ret; =20 + adev =3D ACPI_COMPANION(&pdev->dev); + if (!adev) + return -ENODEV; + if (adev->dep_unmet) return -EPROBE_DEFER; =20 --=20 2.43.0