Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2873465pxu; Sat, 19 Dec 2020 04:59:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuXC1bGZ1Nqthn+3CrLok14Dwkx7YqiYnLG23rwh00LZ2SjXJ5crKJE2+tscyZWJ8w7KBj X-Received: by 2002:aa7:d7d2:: with SMTP id e18mr8872670eds.256.1608382792097; Sat, 19 Dec 2020 04:59:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608382792; cv=none; d=google.com; s=arc-20160816; b=c6MibN3HM7/1ugHNSl7qhK3loTdEfAOkW4bG1725bhxuqg+UjXL/lgIymQKhlUujfW txkKs1MMjL1quyI0qmZFoM1Dp56CkUayUtkNhuM3mYNd2ldmsi6WthYyJS+F07yzNeVT o5Cxh8FIFHPw8Cobo0vKRcD2N8udzZ31a8+iUueaCgjo9+RB+LoU/RKlaMiB1nLsh13U 1/aaFVGSoYQFbMGqDq9H5e/bdq3zgJTCnydkW/7Y+/EjvZm0uhz6o4RQyzlIuG3V5Uxm bSHbwNmqjEygxzlrt4xCNhCzzKIQEL9tefRd2Ss5OzR1nopwJHx6Xb4wTcP3YHX2owpK ooHQ== 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=IKr/PvEbiP5S8sjNEMaGdxUF0SBn9dwx1lSzJNtpIUvMD3bRAmeknQZncbEpuIozgP Xwl1Js0fVYP+cAEUgJGp9l6Hyd/LUsyPPt8pT84Ltm7ZCSnFIQy+rMmAb+JVS8wwlMgc ykmLFpPJA17V1/OJ6j3FapEpSXHw4ZcoiCLHSq7M/py57NG/S8hwrYzaA++6+8KTybkQ F9zXRvdNzA2AaIZSrqdrcmo8kwCJr2Kj1pDuF/UFUL5cFEvi6TX2AAaYBCtXKMEwJPLb lCeYqhGVfhdDTc+pBP9HEvnyHYRkq+8cgBOXnePYIGCtGNh+c83Bnyzs1+Pf+DSNJyTn lUgw== 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 u9si7834113edd.596.2020.12.19.04.59.29; Sat, 19 Dec 2020 04:59:52 -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 S1727274AbgLSM5o (ORCPT + 99 others); Sat, 19 Dec 2020 07:57:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:44022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727127AbgLSM5j (ORCPT ); Sat, 19 Dec 2020 07:57:39 -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.10 07/16] ALSA: usb-audio: Fix potential out-of-bounds shift Date: Sat, 19 Dec 2020 13:57:14 +0100 Message-Id: <20201219125339.429141718@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125339.066340030@linuxfoundation.org> References: <20201219125339.066340030@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;