From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB043C982ED for ; Mon, 21 Sep 2026 19:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n4tfQQNoh1s0SuFBn8g/TxJGhMe3ZOSgNRY3dXc6AJk=; b=R2eaXGFBFcB+21dwLbbC5hnuLX xBcq63GsePvy9K3XjtyxBPeczs23GG9mdL5cv6zQeECmEEsTq+/dbLGE9le29xIw11i2KbUBaCFtF nvHq5tETQRGbB/7oAbtxdDoGlO+aOTRRN9wEIlipdcqGy8CzkuyqwoAAkSz5onnBlh6dl9SJ8h0Wu UC2b1iBdPD42nXF3srroeNLC+BzrYVZM/AHgHNeSSe4wTqbZLksttqYDzM4BbiqVWI5p/QwcNEDhx shbFwJHzaEGrD/nAlB622XbiVFLAOwYrnGO1wytul4nVedgwxZwtVJtJymagdTdltbxb73WMZZt4j KI58LRZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x8k9K-00000003Hom-3ePv; Mon, 21 Sep 2026 19:58:02 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x8k9J-00000003Hnn-3iet for linux-arm-kernel@lists.infradead.org; Mon, 21 Sep 2026 19:58:01 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 5567B601F0; Mon, 21 Sep 2026 19:58:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 763B91F000FF; Mon, 21 Sep 2026 19:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790020681; bh=n4tfQQNoh1s0SuFBn8g/TxJGhMe3ZOSgNRY3dXc6AJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ci0EfexEzpXudF6A1c0TRtaS3ijsUSJzv01W1MLD2bmATKrk4YDSRg9uokuQTkYan urzbYyusNB+l570E5twrDA1odMxPLzuEshNs6shFYh7z7YT1HLPBhUZTBB8UUz/NDp DrCb4KDhJ8OUEOs7U+IbTOs/3KI0DnpxKsWjXdModl6jPM22pi7RlmvW7WL6q+E+Tu iS657fJiAxB7i8oRzIHoC0Vm/Or2EPgEm/yHGYZBleqSlxQybJDLd7bVQSOJfd0nUt Zw4WOcr1rc00S7qHzQL747+8FZYX4Y5yDELZISU2iLc8BNhPOIj3b1lrJDbfR0Vyyo W7Q5xsASeT4Ew== From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Andy Shevchenko , Mika Westerberg , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Ilias Apalodimas , linux-efi@vger.kernel.org, Will Deacon , Robin Murphy , "Joerg Roedel (AMD)" , Mark Pearson , "Derek J. Clark" , Hans de Goede , Ilpo =?UTF-8?B?SsOkcnZpbmVu?= , platform-driver-x86@vger.kernel.org, David Rhodes , Richard Fitzgerald , Jaroslav Kysela , Takashi Iwai , linux-sound@vger.kernel.org, Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Vijendar Mukunda , Venkata Prasad Potturu , Liam Girdwood , Mark Brown , Cezary Rojewski , Peter Ujfalusi , Bard Liao , Kai Vehmanen , Pierre-Louis Bossart , Binbin Zhou , Andreas Noever , Mika Westerberg , Yehezkel Bernat Subject: [PATCH v1 12/17] ALSA: hda: tas2781: Switch to use acpi_bus_get_primary_device() Date: Mon, 21 Sep 2026 21:53:12 +0200 Message-ID: <895014215.0ifERbkFSE@rafael.j.wysocki> Organization: Linux Kernel Development - Intel In-Reply-To: <7995179.EvYhyI6sBW@rafael.j.wysocki> References: <7995179.EvYhyI6sBW@rafael.j.wysocki> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Rafael J. Wysocki" Replace acpi_get_first_physical_node() that is slated for removal with acpi_bus_get_primary_device() that takes a reference to the device it is about to return. This addresses a potential use-after-free that may occur if the device returned by acpi_get_first_physical_node() is removed right after dropping its ACPI companion's physical_node_lock in that function. Signed-off-by: Rafael J. Wysocki --- sound/hda/codecs/side-codecs/tas2781_hda_i2c.c | 3 +-- sound/hda/codecs/side-codecs/tas2781_hda_spi.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c index 5e5f46c9fb6b..161ca965c63e 100644 --- a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c +++ b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c @@ -100,8 +100,7 @@ static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid) return -ENODEV; } - struct device *physdev __free(put_device) = - get_device(acpi_get_first_physical_node(adev)); + struct device *physdev __free(put_device) = acpi_bus_get_primary_device(adev); ret = acpi_dev_get_resources(adev, &resources, tas2781_get_i2c_res, p); if (ret < 0) { dev_err(p->dev, "Failed to get ACPI resource.\n"); diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_spi.c b/sound/hda/codecs/side-codecs/tas2781_hda_spi.c index da71b57a26ee..f3ba7132d2b8 100644 --- a/sound/hda/codecs/side-codecs/tas2781_hda_spi.c +++ b/sound/hda/codecs/side-codecs/tas2781_hda_spi.c @@ -341,8 +341,7 @@ static int tas2781_read_acpi(struct tas2781_hda *tas_hda, strscpy(p->dev_name, hid, sizeof(p->dev_name)); - struct device *physdev __free(put_device) = - get_device(acpi_get_first_physical_node(adev)); + struct device *physdev __free(put_device) = acpi_bus_get_primary_device(adev); acpi_dev_put(adev); if (!physdev) return -ENODEV; -- 2.51.0