From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796394329; b=ElXKyDFQZAX7nNndGRPoDxPDidcff91jv+ULgG/1R8g7smf88YmOZv6WoLGRFYjMbIGs N2CswsVcAqTm0/9MFEOOZUeeTzFGc54aoTXQWk+nWKJxpMK4PhpZmZgABfzgEqnGhCH5Q rTVJvtS5aCDteDkHDKUrTGVxc6qktEf1YZVsKGd+cmoqb/zr/SfEa0OPhD8gghJ8snwk7 jaTp5KVP7XNcPoFlyh2riDZFVN7VbEiE0U5+Kp5s3dHlvQyPBj7yLtGRjp8mw3gVDpdsY rNOFSeDg5lA91hQDz6f3AsvbCkZiYveme4c3jyBnES3RRR0mAZI+qsYRsAqS9MlvbmQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394329; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=N5Kh18Qw23VTW7/5bADRCqRMPu+UBK2i6GLNeqQfX0c=; b=3nkvkpBEd1ZGrbam+7dfC1EVsMAacC85kvAwFDnrx6CBpy8nvwSK7xuATIVf1pShm4pi i/coi6SWxZQaFU8rsMwcbgN6ARlFkwlKLVH64w3toTYxDmRbrcMaKP/XaI2NC0yREBkai LkebfbWjbAFRswAkipK8V8rg548QADPa3oQ9QJ/7IxG8U3eqDMbCfxB/1xQwY+SzJzJYc 25sMqyQBxTX4oqn/NPK8INQ3TijasTD7+Z+dgv7Z2UUyLSpJjnR5ggoAEdlcCUdcFSnPY S0RZ2d7ASi2dIjp1X+0TD+kRtl1xOQzgddjE4b6ImcQ8lXNdXW/U+HwGjFcCtQ9EZeg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kriH7mrI; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FA78606A322; Fri, 4 Dec 2026 14:25:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kriH7mrI Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACEF31F000C2; Fri, 4 Dec 2026 14:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796394329; bh=N5Kh18Qw23VTW7/5bADRCqRMPu+UBK2i6GLNeqQfX0c=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=kriH7mrIg90Lhi7WodnuOy44VexHlgWyjG9PSUFqKaS5DiH5FZAbWhtep2RZCWNsl zeGTERHKE1665M1IPBDsIMj0auw2xSmDGMnacv7rHDKLhEUOoPSW02EGhUvUmG775e YMmsw2CDPCdqMS2+duKHKcPkr8vCi4adhnnSlOamhjwPkdSP76sNB2re8Evj/AkqUH 9BSF2ZO7XN0+WuR0idiJs1RPx9KtIL5d4m5FtyLKkFx3kMY1NYzZV100O5NBpi2Ia/ Hl22TzbJpFq1T8IitDoa4Gkl/ys8Kgg7hTszIgtDZsaDoNSR1iSJgzhwf3zLzi04en DNd6vd3xPMVRg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 11/14] acpi: disable battery and adapter for x86 apple machines Reply-To: sashiko-reviews@lists.linux.dev To: "Atharva Tiwari" Cc: "Ihor Odainyi" , "Antoine Sidem" , "Aditya Garg" , "Bjorn Helgaas" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , x86@kernel.org, "H. Peter Anvin" , "Rafael J. Wysocki" , "Len Brown" , "Linus Walleij" , "Bartosz Golaszewski" , "Sven Peter" , "Janne Grunau" , "Neal Gompa" , "Guenter Roeck" , "Jonathan Cameron" , "David Lechner" , =?utf-8?b?TnVubyBTw6E=?= , "Andy Shevchenko" , "Lee Jones" , "Pavel Machek" , "Griffin Kroah-Hartman" , "Hans de Goede" , =?utf-8?b?SWxwbyBKw6RydmluZW4=?= , "Sebastian Reichel" , "Alexandre Belloni" , "Wim Van Sebroeck" , "Jarkko Sakkinen" , "Mimi Zohar" , "Roberto Sassu" , "Dmitry Kasatkin" , "Eric Snowberg" , "Paul Moore" , "James Morris" , "Serge E. Hallyn" , linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-leds@vger.kernel.org, mfd@lists.linux.dev, linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org In-Reply-To: <20261204131619.5059-12-atharvatiwarilinuxdev@gmail.com> References: <20261204131619.5059-1-atharvatiwarilinuxdev@gmail.com> <20261204131619.5059-12-atharvatiwarilinuxdev@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:25:25 +0000 X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] acpi: unconditional skip leaves Intel Macs without battery or AC drivers - [High] power: supply: NULL power->adapter deref in macsmc_power_probe() - [Low] acpi: Apple skip check bypasses DMI overrides and is duplicated in sbs.c -- commit 1f23bca9ef468a05d91753f57047443718511acf Author: Atharva Tiwari acpi: disable battery and adapter for x86 apple machines This commit skips probing acpi-sbs and disables the ACPI AC and battery drivers on x86 Apple machines when CONFIG_MACSMC_ACPI and CONFIG_MACSMC_POWER are enabled. > diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c > index f10bbf13c242f..368bcae7223f3 100644 > --- a/drivers/acpi/sbs.c > +++ b/drivers/acpi/sbs.c > @@ -634,6 +634,10 @@ static int acpi_sbs_probe(struct platform_device *pd= ev) > int result =3D 0; > int id; > =20 > + if (IS_ENABLED(CONFIG_MACSMC_ACPI) && > + IS_ENABLED(CONFIG_MACSMC_POWER) && x86_apple_machine) > + return -ENODEV; > + > device =3D ACPI_COMPANION(&pdev->dev); > if (!device) > return -ENODEV; [Severity: High] Can this leave Intel Macs without any battery or AC adapter drivers? Both acpi_sbs_probe() here and acpi_quirk_skip_acpi_ac_and_battery() in drivers/acpi/x86/utils.c disable the ACPI drivers using compile-time IS_ENABLED() checks and x86_apple_machine, without verifying that macsmc-acpi and macsmc-power actually bind or that APP0001 and ACPI0003 are present. Because CONFIG_MACSMC_ACPI, CONFIG_MACSMC_POWER, and CONFIG_SENSORS_APPLESMC are tristate options with no Kconfig exclusion, a distribution or allmodconfig kernel can load applesmc first. applesmc_init() then claims the SMC I/O ports with request_region(), causing apple_smc_acpi_probe() to fail with -EBUSY so macsmc-power is never instantiated. Similarly, macsmc_power_probe() fails with -ENODEV on battery-equipped Intel Macs that lack ACPI0003. Since acpi_ac_init() and acpi_battery_init() only check acpi_quirk_skip_acpi_ac_and_battery() once at init and return -ENODEV, the system ends up with no battery or AC power_supply devices. > diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c > index 418951639f511..2c54c0f679bfd 100644 > --- a/drivers/acpi/x86/utils.c > +++ b/drivers/acpi/x86/utils.c [ ... ] > @@ -608,6 +609,10 @@ bool acpi_quirk_skip_acpi_ac_and_battery(void) > long quirks =3D 0; > int i; > =20 > + if (IS_ENABLED(CONFIG_MACSMC_ACPI) && > + IS_ENABLED(CONFIG_MACSMC_POWER) && x86_apple_machine) > + return true; > + > dmi_id =3D dmi_first_match(acpi_quirk_skip_dmi_ids); > if (dmi_id) > quirks =3D (unsigned long)dmi_id->driver_data; [Severity: Low] Does returning before dmi_first_match(acpi_quirk_skip_dmi_ids) bypass the ACPI_QUIRK_USE_ACPI_AC_AND_BATTERY override mechanism? Unlike the existing PMIC checks further down in this function, this early return would prevent any future Apple DMI entry from opting back into the ACPI AC and battery drivers. Also, acpi_sbs_probe() duplicates this check instead of reusing acpi_quirk_skip_acpi_ac_and_battery(), and the drivers/acpi/sbs.c diff drops an unrelated blank line. [Severity: High] With this commit relying on macsmc-power to replace the ACPI drivers, can macsmc_power_probe() from commit "power/supply: add support for x86 macs in macsmc-power" dereference a NULL power->adapter during probe? macsmc_power_probe() registers power->batt and power->ac with devm_power_supply_register() before assigning power->adapter via acpi_dev_get_first_match_dev("ACPI0003", NULL, -1): CPU0 CPU1 macsmc_power_probe() devm_power_supply_register() sysfs read (status) macsmc_battery_acpi_get_status() power->adapter->handle <-- NULL deref power->adapter =3D ... Any read of POWER_SUPPLY_PROP_STATUS in macsmc_battery_acpi_get_status() or POWER_SUPPLY_PROP_ONLINE in macsmc_ac_get_property() during this window, or during devm teardown if the ACPI0003 lookup or notify installation fails, hits a NULL pointer dereference and kernel oops. Looking up power->adapter before registering the power_supply devices would avoid this window. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204131619.5059= -1-atharvatiwarilinuxdev@gmail.com?part=3D11