Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9183342pxu; Mon, 28 Dec 2020 08:39:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxx5169PZLMz0uc8rsEzCQfwDJRZ3Ds4ZdTZqpl3Mo9TsBDxD0T0safIZzxO9xkosgc8glf X-Received: by 2002:a17:906:fb9b:: with SMTP id lr27mr43264866ejb.175.1609173585259; Mon, 28 Dec 2020 08:39:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173585; cv=none; d=google.com; s=arc-20160816; b=LeYIQEF7aAvo9ZXpuiutewPEpzSJxjoYNj7Ulz6CWpm+yFOTBU/5Kdy531hOAs6BQd srYeEc9b9tCgIf/iPyzxwpYjEdtmhtVZVW/Zh0UrKWjwdLHNVN+4FVPDQ6120GWdDmxW Ybcp+vQU91DBbISLJrMHOTNo9UXlij1lZ8zZoYdFK8fsHF/GN2FLxYT8cUrBpj3HQkYE K3DlLnvsC/QEEhoCS9WkVlvEph1uqCxEpNeQwHQQm39KZZv1ozZlq21drcF6Yg1dbq9H b2v1T+lzMAe5HBymQPqMiDGNy+6sIDUVOX8VPMtWg+31DmxwI09Hw76PVSYGZMsD+Nwd RDgw== 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:dkim-signature; bh=icjDxZzPxRf/GN35HXzQAgNqlo+iL16EwHsehMr0dsU=; b=rERsNEm69zQkMMRd1HbelPXdmdcY/QQjfF/zht9X1xrz8/1OIZ+GhoYOVpspXax6ow 8dEO6kEGWf/evQxzrh08/PCjJitlDyEsAmWVJk/jsj6jnNmGcg6f1Wl5UW2XJXY6PS3S 3OxV1lVbrKbnk3D5o0VYieXwqLDSx6bqkxSGvqqZD3tZ25vqq3j53kLz9MS/ZN0G+XMo cQmkyS6iIQKGBDG/EGf676XBxBb97bxOotzukcr0gtQ4Xyq5EzvZK4hV8158iMMJwA5h +WCIaWd3UiKI2iW7GfOCx+MIuZTbSaxImh+IzXybcA2ECE9x1s+PEmreg44PT2ChahYe VBjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MZZoQm17; 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=pass (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 dp16si21397913ejc.614.2020.12.28.08.39.23; Mon, 28 Dec 2020 08:39:45 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MZZoQm17; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633723AbgL1Qha (ORCPT + 99 others); Mon, 28 Dec 2020 11:37:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:58042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729843AbgL1NBp (ORCPT ); Mon, 28 Dec 2020 08:01:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 56D6221D94; Mon, 28 Dec 2020 13:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160464; bh=dwqTAokXpysVZGBemVnEBeDmQu20+uI6XLgm1AZ8Yks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZZoQm17ZHIbIYcGSqcdr9BR27mwfgSfUhe+BRkmsTa39522lIv7VsFdxV686PBM8 mdYfREvhYT0IM4y4PiNDaoob+04srR3yqM3OZAo8g6Y1EcOI2Lyga0a6WMnNsLYWfC FTvhg0Uc8IVkeL6/FwARX8/Dg9KVvFu6a+xeN/0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+df7dc146ebdd6435eea3@syzkaller.appspotmail.com, Takashi Iwai Subject: [PATCH 4.9 020/175] ALSA: usb-audio: Fix potential out-of-bounds shift Date: Mon, 28 Dec 2020 13:47:53 +0100 Message-Id: <20201228124854.231693629@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 @@ -52,6 +52,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 = 1 << format;