From patchwork Mon Jul 15 19:42:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1960825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WNCKG6Bnhz20CW for ; Tue, 16 Jul 2024 05:42:42 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sTRah-0007sS-KK; Mon, 15 Jul 2024 19:42:31 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sTRae-0007s3-HP for kernel-team@lists.ubuntu.com; Mon, 15 Jul 2024 19:42:28 +0000 Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id C9C5E3F4C6 for ; Mon, 15 Jul 2024 19:42:27 +0000 (UTC) Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7f61da4d7beso552689739f.2 for ; Mon, 15 Jul 2024 12:42:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721072546; x=1721677346; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EFOSAvrDuCtJBVeqfabbykqWypiJVUp1riunnuDxwfU=; b=nm9akaj6cGLdbE5bIaWiIOchhMgvsMa6mhPFV1ASMLP1v38zEHIMkqnWlxm1ltvkes p9rwUrT1Mrtcm7lU0Go3ybtZeGjUMHWF6KvHh7/eIacd7goN8/2/qc55Ovdlp+pvzJ1l BPND8AvHTgQ1G5ec6bDTLPCgfY7dG6Tvi8hpf98LfVWlTyl2S0ROiwbCEqDPzFJFhA/3 wYo4uiG3cqmbB0g7dfXIY6dB+O+DZL5pzKhiwMfpG0CGJPmTsBXWNExz7DwXHZqgpHq8 dTJySl1gvwN8VpP+BuculeHHMbDD9fQwMJTDtSO3EcHaC+j3bYpnaZ+K8fpfs08WqTVB 0n7g== X-Gm-Message-State: AOJu0Yy0dtMBCqCx0jgtv3/ueiiAovz61WY5CtABLudY/OTdDBide1Oi fGHJ0+avrproqWS0EnIMzk97EArPrbPp2HTlQhk52ojlOtpiFN/Izgynri6HX2vUbaN5I9Z7AVh d7IS2b7i74a1xJiioOF1nccYCmaR2EWxdEMpVeJrcocBhZ58gUNBaFnyk7+iScpMOscvFlZEF/w qKbvoyNY8XCA== X-Received: by 2002:a05:6602:1505:b0:7f6:85b2:6384 with SMTP id ca18e2360f4ac-815766102e4mr17910339f.14.1721072546415; Mon, 15 Jul 2024 12:42:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3VxwMdc+p08AHBJ02DCwZaoCHpFMzp3e1am+l2FIkkuIzOmMCu9tHcwbyCBV4koeT2zPa0g== X-Received: by 2002:a05:6602:1505:b0:7f6:85b2:6384 with SMTP id ca18e2360f4ac-815766102e4mr17908339f.14.1721072546059; Mon, 15 Jul 2024 12:42:26 -0700 (PDT) Received: from smtp.gmail.com (167-248-51-36.oa02.lnk04.ne.dynamic.allophone.net. [167.248.51.36]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4c1e1b0c439sm1376335173.8.2024.07.15.12.42.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 12:42:25 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][F][PATCH 1/1] ALSA: hda: intel-sdw-acpi: harden detection of controller Date: Mon, 15 Jul 2024 14:42:23 -0500 Message-Id: <20240715194223.56282-2-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715194223.56282-1-bethany.jamison@canonical.com> References: <20240715194223.56282-1-bethany.jamison@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Libin Yang The existing code currently sets a pointer to an ACPI handle before checking that it's actually a SoundWire controller. This can lead to issues where the graph walk continues and eventually fails, but the pointer was set already. This patch changes the logic so that the information provided to the caller is set when a controller is found. Reviewed-by: Péter Ujfalusi Signed-off-by: Libin Yang Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20211221010817.23636-2-yung-chuan.liao@linux.intel.com Signed-off-by: Takashi Iwai (backported from commit 385f287f9853da402d94278e59f594501c1d1dad) [bjamison: context conflict due to commits 6d2c666 (soundwire: intel: transition to 3 steps initialization) and 08c2a4b (ALSA: hda: move Intel SoundWire ACPI scan to dedicated module) which could not be applied, fix change implemented as given] CVE-2021-46926 Signed-off-by: Bethany Jamison --- drivers/soundwire/intel_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index b74c2f1449621..86f446802ee21 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -178,8 +178,6 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, return AE_NOT_FOUND; } - res->handle = handle; - /* * On some Intel platforms, multiple children of the HDAS * device can be found, but only one of them is the SoundWire @@ -190,6 +188,9 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, if ((adr & GENMASK(31, 28)) >> 28 != SDW_LINK_TYPE) return AE_OK; /* keep going */ + /* found the correct SoundWire controller */ + res->handle = handle; + /* device found, stop namespace walk */ return AE_CTRL_TERMINATE; }