Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2877043pxu; Sat, 19 Dec 2020 05:04:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEbyu65DcAOLliGE55GjWx+WZJc549eELiHKvyDPtTGsZLdnQZVBd7wgvQi/SRRAGO71M+ X-Received: by 2002:a17:906:878d:: with SMTP id za13mr8194618ejb.395.1608383088228; Sat, 19 Dec 2020 05:04:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608383088; cv=none; d=google.com; s=arc-20160816; b=EiK6zQpmCBYlF9S06cg9t6d3nKUvzUQ6vKF7QseJdt3VSwonY20TxMuqylbLbcY1QR 50WkZYsS2epCJ51TSzwRVkWuSgbYBXqL35C7LPDknU0CB5qmXSOnhopj0Q3N2U8kQUhi vvj7ToWBUy5h1dvpUXpCeYir7mtRUjbwa/UffXdWapU36Q8i/2kXF/55rP/3dKSI5tnt 96sKtcK5rZKrgbOg2dkrNd/ecfgTGVJflYsIEsb7+K+ofWxQpIYOhXXK02QwB5YJ2PgJ QWt4aYvf/aQ4gx/8xayJ8nFV31mPtlje3uZP5Vj4ugX7BYs2Llz48Zb9nueUqfk5oHCx Myhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=00A+RKPJI/c6oNH56iBgn8Rstmgp7gXu9aemQbfDxlA=; b=r2bDlML1nsTKVA58ZUMOlJD5MPqEcMqBVsxSMZj5Pl+j7ScfpEG89J/Y3aqhstBI7Z pwUE9evgRUYHj+jaOYKoWkJcTr+9LS0HKnSHP7HAVk/zodzZ8dMIDTUMkDylc4Xj4/vk BItbl7EQVPfFbWuI1RzTRZdIRwjP9+ucc3EoMMhZkw5lwZhq6okaYYf0qs8qYevdmqgw 2u6KiUgvdseAbzsgKx/6wBdHcMk8dqeUJN5CMBPYfIhzUOV+L1YESO76QcRHC2AateMG 4g2l5DA7KsQZyK0rrkdCWy+ZY0hkvwplrIi+i22ZNZOcP0Y3TDm8fncCPElUOfFkRd8X NwUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 15si6720253ejg.14.2020.12.19.05.04.25; Sat, 19 Dec 2020 05:04:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727661AbgLSNCy (ORCPT + 99 others); Sat, 19 Dec 2020 08:02:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:45232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727894AbgLSM6x (ORCPT ); Sat, 19 Dec 2020 07:58:53 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+df7dc146ebdd6435eea3@syzkaller.appspotmail.com, Takashi Iwai Subject: [PATCH 5.9 37/49] ALSA: usb-audio: Fix potential out-of-bounds shift Date: Sat, 19 Dec 2020 13:58:41 +0100 Message-Id: <20201219125346.486923224@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125344.671832095@linuxfoundation.org> References: <20201219125344.671832095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 43d5ca88dfcd35e43010fdd818e067aa9a55f5ba upstream. syzbot spotted a potential out-of-bounds shift in the USB-audio format parser that receives the arbitrary shift value from the USB descriptor. Add a range check for avoiding the undefined behavior. Reported-by: syzbot+df7dc146ebdd6435eea3@syzkaller.appspotmail.com Cc: Link: https://lore.kernel.org/r/20201209084552.17109-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/format.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -40,6 +40,8 @@ static u64 parse_audio_format_i_type(str case UAC_VERSION_1: default: { struct uac_format_type_i_discrete_descriptor *fmt = _fmt; + if (format >= 64) + return 0; /* invalid format */ sample_width = fmt->bBitResolution; sample_bytes = fmt->bSubframeSize; format = 1ULL << format;