Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp400081lqh; Fri, 31 May 2024 05:08:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX/UzupTaLeycBpUUKzRsUD8tKDUCykwB1iDYRNLagDAWOlqjJq4KO4lruQYsc7/VBHtEpOC9nS9x7EbYxHTACyJk1C4QEBtNvS2jRE3A== X-Google-Smtp-Source: AGHT+IEsTcjb8td3o2OpcnE+Ru1q0+DI4rcnIwwMRnSnJ1yYcywQ0v8RTtPGWnGTkUOqAPeX6ct9 X-Received: by 2002:a50:d657:0:b0:57a:33a5:9b78 with SMTP id 4fb4d7f45d1cf-57a364496famr1146497a12.34.1717157322297; Fri, 31 May 2024 05:08:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717157322; cv=pass; d=google.com; s=arc-20160816; b=F5ubYP69W1upjNZeGUjAeibblaRdT8ktRFktWbR1N87Iz2Lo7FkQRZ/ntSmduWvnIi G8/S8AycqRVYE4PZ+Gq1+QT1dtjkMwsWczaitSngPuS6O0hHOtIN7oSFMwErjldjwZ+V RLQeSA1UPA9z16Bo0oN8V1UIORLBZUf10aJLDUJuBrBUZ+7HbA+DFiZz5+gCH8Rp2UTN 3Ov6jalf6EkDCA1/m7X2cZqxSZuk+bVTMuypsXVNKzYJfgopF5g1CFdXrR17FY3Q/8x6 nbTFDMneHV1wdtqTa5ShmilxlCrqIFjw8ZvVIpk4j+D3MFRxtraVIRpvTIDHQUMZZB3A adwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=jojeGL9NyCQPAKin3J/C+KRxMKRG2M3M0NSuFuoQxSM=; fh=z7rId80B5i8icwLN4amYRAcHgJDKcj48lemekrTKtzM=; b=Pw6G5ZJVGNTKb6L8H5RZCegROiEiztyEs7uyQjj0aCbvytodjGqowU06piQ/4x/hwP RAEa6NuwO8l2/usifLE88XFXpprZNzARje9kvj53Pt4og6R4Mfr6WwqHxo3PLO4WQJwN 7Xmp4t8ZL9mAnxjQ5GJxotmKGmbCcT38G49IavmKTsqd56Ptj8YoTY98J0Cab3OHFCk3 2IgL7BKUxb3AUamFYPyvqO7LarPL7vyPitG5TReiJ+BpVXzBLv4vHSGRuuBu3Xt6EL0I MZJLbZ+GE1STxHscrxGMgj0wxIl6D9+jjxeswOiC+iKGiiKjj9lAsRVCqBYFd8dB8YP4 B09w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=WTtiUWul; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-196752-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196752-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31ba7e8asi885483a12.174.2024.05.31.05.08.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 05:08:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196752-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=WTtiUWul; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-196752-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196752-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 022841F2569F for ; Fri, 31 May 2024 12:08:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62D7B1581FB; Fri, 31 May 2024 12:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="WTtiUWul" Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 F17EE29A0; Fri, 31 May 2024 12:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717157314; cv=none; b=TDVFxyn5xS3yLTUiYjnH6pWVr+6+Nl5gLbde8JdkYWyerUJKcQqvL/Ua4uAduGF8+l7OGVFMZA2DdVyRwOcYcN5PejZ880/sm7BEBufRXc/B4746nakuQP4pvwuLhOw2vN5M5PtQkVkv9V0l2NV1Zxl2tCNyLBSSos1QwuROhPo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717157314; c=relaxed/simple; bh=1k9t6jehRo7chIdZq9uoVU5h/rfm2SsMzqY7xyvvVbc=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=kiwyIHTQudoV4/haLqtHJ0GYJ8+DKPbCD6N8GpxxgB/eNBJECoprpOjgnQwRXN6jUT1Lzvkct4uMyy6OjlwFbpnBr2IY4dUO2BWlS7rTizUMfHjZp9KjAc9kIdTGRCOterFdATTGhTVnwuxv9HcWhIWLHf6v1Ib+bdPqwqrkoaU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=WTtiUWul; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44V9Swja003313; Fri, 31 May 2024 07:08:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=PODMain02222019; bh=jojeGL9NyCQPAKin 3J/C+KRxMKRG2M3M0NSuFuoQxSM=; b=WTtiUWul1jMchiPb35GkiMk6reG9QZuI 48PSnH7FRwqA+ufeElYJFPPyAttpKcGEgJLi7YJy5Sx4Bm3dQCDkHkj6BjxebA23 LvpHU6rrdtntXesH7YLoxoVTnJaUbPFe7wEfBjz9x7niJc2Yxaq/4p4FHd8Ava3Y qsEEuxDnQug6fRSZ7po6MhMwny4XNWqBtHgZET1NUhkjyFoe6Z5qrsjg5/vI4b7J xnftqLmiUCfAGXmQ/y//2xgH/MfbVrABHyVn0/7KRU4wrRN+GodFF5/G/yIS6mcJ xg0Pnl36qQboKIfahQkTgY4mxr9FDX8H2Sq4MByJg3+sxj+r+1gIMQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ybdcwwr9x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 May 2024 07:08:26 -0500 (CDT) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 31 May 2024 13:08:23 +0100 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1544.9 via Frontend Transport; Fri, 31 May 2024 13:08:23 +0100 Received: from EDIN6ZZ2FY3.ad.cirrus.com (EDIN6ZZ2FY3.ad.cirrus.com [198.61.65.72]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 8B538820249; Fri, 31 May 2024 12:08:23 +0000 (UTC) From: Simon Trimmer To: CC: , , , , "Simon Trimmer" Subject: [PATCH] ALSA: hda: cs35l41: Possible null pointer dereference in cs35l41_hda_unbind() Date: Fri, 31 May 2024 13:08:20 +0100 Message-ID: <20240531120820.35367-1-simont@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: kwle0reXsEGM8-ag8K8DUTPDf-O3TQxB X-Proofpoint-ORIG-GUID: kwle0reXsEGM8-ag8K8DUTPDf-O3TQxB X-Proofpoint-Spam-Reason: safe The cs35l41_hda_unbind() function clears the hda_component entry matching it's index and then dereferences the codec pointer held in the first element of the hda_component array, this is an issue when the device index was 0. Instead use the codec pointer stashed in the cs35l41_hda structure as it will still be valid. Fixes: 7cf5ce66dfda ("ALSA: hda: cs35l41: Add device_link between HDA and cs35l41_hda") Signed-off-by: Simon Trimmer --- sound/pci/hda/cs35l41_hda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 6c49e5c6cd20..d54d4d60b03e 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -1495,7 +1495,7 @@ static void cs35l41_hda_unbind(struct device *dev, struct device *master, void * if (comps[cs35l41->index].dev == dev) { memset(&comps[cs35l41->index], 0, sizeof(*comps)); sleep_flags = lock_system_sleep(); - device_link_remove(&comps->codec->core.dev, cs35l41->dev); + device_link_remove(&cs35l41->codec->core.dev, cs35l41->dev); unlock_system_sleep(sleep_flags); } } -- 2.34.1