Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2350303pxb; Mon, 20 Sep 2021 19:45:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNGMVi/giaWnjQccTIBo6/KAIKiA6C7ig7CagQGFjNmYccD21igHgLevlkv1Tk3acHfJV9 X-Received: by 2002:a17:906:3a0f:: with SMTP id z15mr33405812eje.42.1632192311356; Mon, 20 Sep 2021 19:45:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192311; cv=none; d=google.com; s=arc-20160816; b=EWGXUz/Xjop4k2cNR4gGLELGEexi4hQXBgfy3q/l8Tlew/7Uo7QgCltmlTxPMao45P t7UhKjit2oaXcHnWG4+amr9KxZvv4X5vrdLKBSsO2B1a92VQ1b7pKtdnL+pIgbTq92LA Crun73rBuWt22xqbNWECdSdkYygdyrhbNyDqNcBnn6zeh94/4+PKwX3TSS52ZGCuoyFv FtOvxbAgcdAnzjll04ElB8/+FKgMVTS3DBaLNUCeYs/gU3dce2decN4R9mvyhw795rjy 1k05Vl40bgXqfDEAMA89aL+7/Jny/2n3yWDRZ5FMVfcV1Z4/Oki9Cg+AOgkJNZuCuGbX 4VbA== 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=1DAsgREVIYKEdRIjW/b+SqFVpPuOzGU8Ueo5KZ0C94o=; b=v588jO8+NbVpACJc224Dg32ieJ5DHdg4WE+RrsKZ0JGInftpajVteHw6c9wS0IG2fF tSTj0/FoP1eqvn7Qa4taK0dXIO6v6SISlMFHIo2cVa4CgqPJeBgvMZgs1aTCz6AvWGRV PYRBmZqHipb7c4tlVLvvyzNUwP+vEQq+uqz6GngTh2howB6oocID9mIPA1vmkGRSUlNx c7YUqOGlzfaJm7e81PArmTin3Oybelr/gqqstXVLcqmo5xpYfEguYk/6vQInwxYVbOAn 0KwLZjbtTopXFxOjRo89Zyt7EgmUDnvTS7eBTCRHh68ut6uzzdlM+irma+8c1z/5FzL9 lNRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n6awdn+P; 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 16si17066818ejj.116.2021.09.20.19.44.47; Mon, 20 Sep 2021 19:45:11 -0700 (PDT) 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=n6awdn+P; 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 S1378004AbhITSW0 (ORCPT + 99 others); Mon, 20 Sep 2021 14:22:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:35778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376692AbhITSOP (ORCPT ); Mon, 20 Sep 2021 14:14:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F17936328B; Mon, 20 Sep 2021 17:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158473; bh=wnKwA/60iuYLeWzRlkpXSybYhrzrUEEMFGcIe5dL5PY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n6awdn+PC2adp7qhwqF1ICebSujYNqPhCQM8tJvkMgZ3CvSIsL+141zlNAjiIJmgX aOxQxL6QQKa+BcW7xNE+k8JvxtK/p7Fd4y7w4sG14U2M/+69j55FpK9zIUYsNu8qXN NH3xIAlmx8nGo+FM+WwszlMZxa2gJyDjqm3Qvx7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+2b3e5fb6c7ef285a94f6@syzkaller.appspotmail.com, Haimin Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 172/260] fix array-index-out-of-bounds in taprio_change Date: Mon, 20 Sep 2021 18:43:10 +0200 Message-Id: <20210920163936.929306054@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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: Haimin Zhang [ Upstream commit efe487fce3061d94222c6501d7be3aa549b3dc78 ] syzbot report an array-index-out-of-bounds in taprio_change index 16 is out of range for type '__u16 [16]' that's because mqprio->num_tc is lager than TC_MAX_QUEUE,so we check the return value of netdev_set_num_tc. Reported-by: syzbot+2b3e5fb6c7ef285a94f6@syzkaller.appspotmail.com Signed-off-by: Haimin Zhang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sched/sch_taprio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index a4de4853c79d..da9ed0613eb7 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1503,7 +1503,9 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, taprio_set_picos_per_byte(dev, q); if (mqprio) { - netdev_set_num_tc(dev, mqprio->num_tc); + err = netdev_set_num_tc(dev, mqprio->num_tc); + if (err) + goto free_sched; for (i = 0; i < mqprio->num_tc; i++) netdev_set_tc_queue(dev, i, mqprio->count[i], -- 2.30.2