From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83BECC636CC for ; Mon, 20 Feb 2023 13:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232282AbjBTNqk (ORCPT ); Mon, 20 Feb 2023 08:46:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232302AbjBTNqh (ORCPT ); Mon, 20 Feb 2023 08:46:37 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE6C51D919 for ; Mon, 20 Feb 2023 05:46:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 3DBDFCE0FCF for ; Mon, 20 Feb 2023 13:46:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41540C433D2; Mon, 20 Feb 2023 13:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1676900773; bh=B13805gmhGPOmN6wVSEdk+PBO4qrsLdTpxK+F9q3AEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S3J0eoJTTYkyBAaJ8I1Kpeajcdrwr3STMCwQc289icR/VRvd3N0DMaCCUSKKAwHpl 1iLP7VNgxT7YhKRxQzJmqIJBjx6GRd/n+7HNLqR5+KWIC65sveP/5hYNSCxHE9Tfds 55qdHUBtNYBu/6Gw3Cb6rhpkBpNL5TO4aCh9bTkc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Artemii Karasev , Takashi Iwai Subject: [PATCH 5.4 062/156] ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control() Date: Mon, 20 Feb 2023 14:35:06 +0100 Message-Id: <20230220133604.936845316@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230220133602.515342638@linuxfoundation.org> References: <20230220133602.515342638@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Artemii Karasev commit 6a32425f953b955b4ff82f339d01df0b713caa5d upstream. snd_emux_xg_control() can be called with an argument 'param' greater than size of 'control' array. It may lead to accessing 'control' array at a wrong index. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Artemii Karasev Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: Link: https://lore.kernel.org/r/20230207132026.2870-1-karasev@ispras.ru Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/synth/emux/emux_nrpn.c | 3 +++ 1 file changed, 3 insertions(+) --- a/sound/synth/emux/emux_nrpn.c +++ b/sound/synth/emux/emux_nrpn.c @@ -349,6 +349,9 @@ int snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan, int param) { + if (param >= ARRAY_SIZE(chan->control)) + return -EINVAL; + return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects), port, chan, param, chan->control[param],