Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1573196pxb; Thu, 16 Sep 2021 10:10:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzRDXZRr0MeHRCevnMaTJOXaCxefhSP0TA7ela89eiPTGsU4majbe8bJbCMgbyP39St7kC X-Received: by 2002:a17:906:e1a:: with SMTP id l26mr7260949eji.231.1631812226220; Thu, 16 Sep 2021 10:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631812226; cv=none; d=google.com; s=arc-20160816; b=jbB2e0B9vKMCbh4MwIIe0rFdUgfR9vVhlK6+CJo8b9kCBt/lXBVecHsqllJ8YWLYZ5 Vw/G9lbRow7eLsMCLF2c46/QTWcECdljwW7GTe/QA7Lh5bwz95Fw3Dlj+yjWOdqIWOKu bNMNd/wgp0vog5OiFX1KBL0TFFgM7o30SykS/jTbyhnXiHLRd61W28zgDCmhBWCuBmvw gnWQZd0r2PZG2QuY06Dmgh6lTxe5EdU0euaVWQK08Jpmlss/kNhNWNC9KjdCa9WELDn5 rd3bgscw6ciezYiZ15YPUhE+QamNKNOWRCNA1q8KSjK33nT9faVdkJOHJahSu4LpJF90 4XfQ== 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=6GyI2Daq/Kfx8HxKVkxsA1zxqRUCwmiDKhOGDPVpngM=; b=yetyJDtfGmPNBZNpg+NPKAUfKWGC0lhCXi5SzP5uyg8sJRb2CXQlgJVegwRLLZ1fIi U7agHtPjejJX+6CGMJohOyM2Qu3jP6EMFE9tOxHfqev/jRukllu1fpNV4qXzlwT9LQ82 2rX9bmpenl9egwlVzto3DYPfZpJ4adx3Szpy0l/Hh+A2dDREdLQ+aqt6sQ+uFhkT1P3I UQn2BOYwqgkbb3e3vCONb7PsN2dctpQhz6T3shtf0t/2fxgoS0YUbTpwtuv38THJP+eS 3gNWRo610oMxbrFLQ3nQk2bmyVRCS3LIfsZpEMPdLEZQjK0qh0IuA9OTnDn/ScOuiWxq JbLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pIZXcb34; 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 h6si4618909ejq.154.2021.09.16.10.09.56; Thu, 16 Sep 2021 10:10:26 -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=pIZXcb34; 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 S1350050AbhIPRIs (ORCPT + 99 others); Thu, 16 Sep 2021 13:08:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:54402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347561AbhIPQ7s (ORCPT ); Thu, 16 Sep 2021 12:59:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E05F7613D0; Thu, 16 Sep 2021 16:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809948; bh=CJpWZgJNWPWmgx4F6mrFhgu62lcX0csw5uUVvGK9sN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pIZXcb347iIfqLxX9+0E7DN5YmCvm1BWsJgNI9pEQbM5UgeWaW0xvkNrL9bAspbZb ec7Qmi2YtkIf0Es2TczS+WIUhSCgAyWugNN0jArjIsB4kQi5xAktt3C1qHZ2zGqUDK 2w4tx87kzs+jqZVWuzgUcFGK71QO0L6YV9h9U5tg= 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.13 342/380] fix array-index-out-of-bounds in taprio_change Date: Thu, 16 Sep 2021 18:01:39 +0200 Message-Id: <20210916155815.669270006@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@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 5c91df52b8c2..b0d6385fff9e 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1547,7 +1547,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