Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2878769pxu; Sat, 19 Dec 2020 05:07:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyo4dG+qkm2ZNFeAyh/a+QhNp8T4cj1vtJOsFi/1KK/wYngmS/urPinETPC7MHnLWs31vda X-Received: by 2002:a17:906:7fcd:: with SMTP id r13mr8495670ejs.242.1608383231976; Sat, 19 Dec 2020 05:07:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608383231; cv=none; d=google.com; s=arc-20160816; b=z6Zm/ntIR/JJH/7gonarGK9ZrCwvFUQziIz+RnRiz/CgHMc/vD6kir6vmopN4kKWgH xgaBMHub8dSs/KdaFU7ldF1UzzyFJtIQDFv2euHcggB70rIQpM1icL50fKNciB8Equpb yRxmZTXALD+uWlGydfK9U/1KKxNz7Gewx3OvyU8O8MyCu0CupzUByx+mmqC4zUU/h413 iYMJLvdvlIGrhfwGBEib13pSVi0jrYDudIoUW9Hzhj6m+ujCVq0HOOmkVPiHAr7rO0zu iyU+ILKCUofGfKqsmvwLKHmiVs1CukL6EfcSMtzrmLL+1FzAdTozHvT42FFtFwrjGbhx QMVw== 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=EnOC9YpFVNTVr7n1DAwyFtShg9bm3Tg/CUOJIA8KusPVzfTaoB2hRZ/xNBWwjFfF66 soksmSHJ3vT2TsGqqTp/i3Nfk+4XHTWFNWcVrwyafmKpkh2nQEFT7Flyc0bvF2gXxroE ooBVGVNuZ5kW57+KtQbmsrT+3GQdFaMv0IyL8jJRH2lRBrnGoSHDiwfBAolCJ3lQsbwW DpL5ZORtubD3myhxMrilRTqtsbxuJ+hnkrFLhaauHqDpnulspPekHZpWQMHb+yHTmE9G B6u4INjMiMXWrSkrERqjO8wCosLHyFIDQsc8LPfPhKVq8LthvZjO2CavmPEcSRlG6Rxj DQZg== 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 d12si7438219edh.221.2020.12.19.05.06.49; Sat, 19 Dec 2020 05:07:11 -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 S1728468AbgLSNEF (ORCPT + 99 others); Sat, 19 Dec 2020 08:04:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:51440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbgLSNDs (ORCPT ); Sat, 19 Dec 2020 08:03:48 -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.4 22/34] ALSA: usb-audio: Fix potential out-of-bounds shift Date: Sat, 19 Dec 2020 14:03:19 +0100 Message-Id: <20201219125342.481585405@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125341.384025953@linuxfoundation.org> References: <20201219125341.384025953@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;