From patchwork Thu Oct 10 06:59:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Kosik X-Patchwork-Id: 13829590 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2037.outbound.protection.outlook.com [40.92.90.37]) (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 81AC51B533C; Thu, 10 Oct 2024 06:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.90.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728543559; cv=fail; b=J2FVZ5+7cklqIEhUp0BGHjy3Kjx3SthmOahFeut/P58He07YksBosmPoN2+E5SIK786VAbolbHRPwucCxrOfjX6s6N6MRXdxNNmU+4Mi3NL2oJQhwIwvYfjo0bUzSWIQfAFQbCquqU0GIH5r1gUVtUwjbjfSyDvqq/UlidE0u9U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728543559; c=relaxed/simple; bh=Yl/8CxmsS6s+ZLGpI4+fDnIA9OoPlNyhO4T9KEsWcQY=; h=Message-ID:Date:From:Subject:Cc:To:Content-Type:MIME-Version; b=W1miIt7YfvcNw4BnbBNFo7DABvtdVZS28Yv8REIyJ8RaI2N1UNbW3dQM8UwkU55p5BT7Ow//ypC5B8/x0VgP2jmu99z3vGf8MZlGs+eIXKwM+Pvcnv6wiL9+3bmrsFEYxgE1fwKM0L/HzSt3enuHTcL0oc1S7HTskVvEpxi9+uo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=blGeiC9E; arc=fail smtp.client-ip=40.92.90.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="blGeiC9E" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=btH3fp+VZx5wPuEpHJwQA347GeKaDAVUMq+8XJaVue3B0JGE9SRgr6TzDvTtliYr+M7VBFWlEUw6y9z7MUd9WGdyPmWF2WKLNYNOn+AwZa3ZxeDwLpYe9msit4LVtsdymubsgrHsPZYUjOs0tz+GlxGj7hWI3X1VKO3TJvftdaC27p8ZwQtNBp4KFqGc4rpPXh1biu6ZG51EJkD1EzQ9G7vlSW6n4215M3D6UdwHInisTomTbHWvXDkkOmzndvjKjt/XqFRzPq4+2u2k2fZcySYomQqlzXD0H5O3ICqtK2oqTmFfu7ntLRRDYQ3BMYhlVrDdGu+mtIUDPktn/pz/CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XnI/PSzW7mu6tB1rdnYSTe+5ss6QKmt9vMqAoo/w8Os=; b=AQ6kIyPiABZyWeUyjMoqt1+2AO2hPE8/N8av1KcJksMNCHCvBz2CdDDwh4+/pwAaKqevSWJxdSRzc27fpRi5yOo5YQkkIrSUJ7yTAFcD997D+/PF1aUndlrEBDCjv8an+Y6llyyr+HAb+PgguUIT56Wcqr0pawTq4dvJOrywt6SXRSu04gSagrOYAzAaHTQ5Te8pbVdWLOUw7vVh51hVV3PgwySAG/iR0GM4pBtDx4vkAQSUNtjAz1shfS/Kcx8RpOgw7LWV7pG28mOtiv9ShMfWD8BDjh4LMkfhFN0ZxykFfth39r/r53bINNN06/N6CcXHKQ0f6gPC2gQCEhPT6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XnI/PSzW7mu6tB1rdnYSTe+5ss6QKmt9vMqAoo/w8Os=; b=blGeiC9EVou7mvLeKo53ZaVoFTYJF5JpSgMJMdA0LkGoc1PfMWLhP/5bTVs7yQ3yzKysRimCuFGqsYqLeWYt5wQUqUaFj+bEHAptd/269MtABghwZ1uhILR+uzYwb9khg1aT1ZLHc9TjW75CQAJmGBGQA8vl293RhaMA+RHeD2zFvc93wgk9IkpmkY1BdLwj3N00QstsowD3LnXNIIp8J7movQc8I410NDRz9cN0mLCaROXfLHgaV+7PdGZ0V0XKSuK61RXxvXWlXyEdaLMQphX5XZJGQ4PiF1b72Y10rxigoJYo7Eq3ko+st43EWfMi/ioxLcfzBCjhO4W1iIUVMw== Received: from AS8P190MB1285.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2e0::21) by AM0P190MB0723.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:19b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 06:59:14 +0000 Received: from AS8P190MB1285.EURP190.PROD.OUTLOOK.COM ([fe80::5307:a61:337b:f3fb]) by AS8P190MB1285.EURP190.PROD.OUTLOOK.COM ([fe80::5307:a61:337b:f3fb%4]) with mapi id 15.20.8026.020; Thu, 10 Oct 2024 06:59:14 +0000 Message-ID: Date: Wed, 9 Oct 2024 23:59:10 -0700 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Karol Kosik Subject: [PATCH] ALSA: usb-audio: Fix NULL pointer deref in snd_usb_power_domain_set() Cc: Karol Kosik , Jaroslav Kysela , Johan Carlsson , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org To: Takashi Iwai X-ClientProxiedBy: MW4PR03CA0331.namprd03.prod.outlook.com (2603:10b6:303:dc::6) To AS8P190MB1285.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2e0::21) X-Microsoft-Original-Message-ID: Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P190MB1285:EE_|AM0P190MB0723:EE_ X-MS-Office365-Filtering-Correlation-Id: 73f1020c-4bbb-4963-2c8e-08dce8f90cec X-Microsoft-Antispam: BCL:0;ARA:14566002|15080799006|8060799006|7092599003|6090799003|19110799003|5072599009|461199028|5062599005|3412199025|440099028|1710799026; X-Microsoft-Antispam-Message-Info: HEPZfQRtkkEXFHkKxoqKgmEsagHcwpsCW1OzyC5B/23JmxGG/6xJmX8AHOZoloqhOiyv8B8fG0Shw6Xj2BenAELXIqa6m1cvGgU00AI2Tg0altBQu3ZhLeajWa3wANEsGWGfLlZs0C9Sdra12xtLwOfEPwWeD4uQt0kk7VBdwoJeS4UdMJam0wnIVTS/zOVEZVc6XDOW3J3Y+7wWZ1/lCEzFDwK4bbaxCZ6YXEhsFMCmi/HASpeMXD+tZszPSyXEMIgkbO5MeAJiy4AoIXQECoKf0CeXhG8/OdiazcX2dyT4ISI0OBQT+DXsb6x5HrVtnZC5lWcmXf/eVDoImI6rPQLWOw4dqKkziKU+OZ7PL42xXH9HtsSYm2C21lTfbuwsKL5oAW0wi8n4g+1sCZ3MzjITEC4vSWspo0jXQKIENqSd0KYE15L6n7qftamb6Oyls0Qxmcj+kMpbbmfG6GbWX1kKF//+0kQHBQMlP99rFX90YQqeM0SJHoA3aeRuTPiCLurQfte0/ACd8vfnGI2NSVdV0kdmIdyC1/4FYM73OasZP3DuxPRU+mjsaeASkbC7rnFVr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+NQMiAB4p6pOhL9lXUzg/aFRoIi7+QPQ0w52zeZ0530yFikP/RhU?= =?utf-8?q?7lSQteWv+Lxfy7zXAP1zuTS51V7oTSY1nQgbVF+6a9avlxnEQOS+p2TUqqIsZJokc?= =?utf-8?q?LgM4iD5jXTZjgD/wVwebhx0xDvMzIoe8RC3rNWd1d2Q+ghzmjzYv6tr8KjyLriyFF?= =?utf-8?q?XRZVPBV9UZk4dJHsddEBS0qvWgy0Y2Qi9eWDFGBkKJiKJcOnLUBnHqHNSWU86yUBi?= =?utf-8?q?iFQGljWqr5bIJi0C0C9xelG6CREgjucqU11mS1jNdGqOqqW14AMwM1/bu07+pxaIX?= =?utf-8?q?AFf2ILaw6yvl6eFAw3lpq9dxMg9WpW0aouf453BBWQyehp0RsI1593iSAEDmlzaKs?= =?utf-8?q?YCkUwEC1xWINlFe3tFP3LXlWSnvkao/tDDdO2hZ5bw4R498QSZmJMfgLZiZDe+Peu?= =?utf-8?q?8CocWbDgcHG9RG+Mduj9yyMk/8kdpqBKEz1teCX7vjTfqrmvjRHKaK5qOazRYiPws?= =?utf-8?q?DCzHTqF9eVCC8fZExeEGWXUi5Xl3esdNR+FAaTig2h7PVDOntsjbzS3tZUicED6Ia?= =?utf-8?q?zgpinhOd9gmBtKjTagsBOMBk99z2650acGW9UOnzW4Mns/1k8580C1sQWyTumuEMK?= =?utf-8?q?c7wDSVclxIPg5BvCKhYjhzm1x0lNesA5IhSnmpFhmHyxxTBUSIobBVo6bmPk=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73f1020c-4bbb-4963-2c8e-08dce8f90cec X-MS-Exchange-CrossTenant-AuthSource: AS8P190MB1285.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 06:59:14.5682 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P190MB0723 Commit adding support for multiple control interfaces expanded struct snd_usb_power_domain with pointer to control interface for proper control message routing but missed one initialization point of this structure, which has left new field with NULL value. Standard mandates that each device has at least one control interface and code responsible for power domain does not check for NULL values when querying for control interface. This caused some USB devices to crash the kernel. Fixes: 6aa8700150f7 ("ALSA: usb-audio: Support multiple control interfaces") Signed-off-by: Karol Kosik --- sound/usb/stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/usb/stream.c b/sound/usb/stream.c index d70c140813d6..c1ea8844a46f 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -1067,6 +1067,7 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip, UAC3_BADD_PD_ID10 : UAC3_BADD_PD_ID11; pd->pd_d1d0_rec = UAC3_BADD_PD_RECOVER_D1D0; pd->pd_d2d0_rec = UAC3_BADD_PD_RECOVER_D2D0; + pd->ctrl_iface = ctrl_intf; } else { fp->attributes = parse_uac_endpoint_attributes(chip, alts,