Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2335722ybz; Thu, 23 Apr 2020 16:15:14 -0700 (PDT) X-Google-Smtp-Source: APiQypJShpDCqVUnQE4OJ07GpPLTgs/fkl7hXEfYTQi3AHRm7GriGNne0LKoyyWI3GwL1VLInC1V X-Received: by 2002:aa7:df8a:: with SMTP id b10mr4979259edy.263.1587683714317; Thu, 23 Apr 2020 16:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587683714; cv=none; d=google.com; s=arc-20160816; b=r4QdK33Jc7hH/RfYI1EfeH0WnoNjmgIM6ZdfKMmZ9UieyKuJaaPbaS7Hhszp6CeTIe 1lRnjzkyIdcQr7BTPKF3JVXCZtF0n9AbyFxb9iePszdzqZLEE1q6z1IumE+Xhiq+9PW/ HCTuMH38Z1ouLHFFPY5ZHP1APQlIXgGvAW6UeBHXg3ohdC6aG9EiVo1FTDFI3QD3hEKH Orykl5XPJ2KEY9d4eYYeQGJrZaf9p8lhQo+SshaX4dgidKyHoZ0x77OB3hVfdSOKVCpe M6EuWft1XfgkAtbIsLino8+UIwhVH+nUeFoAKjWwA9jMYNWUS9n1a0rnYuoOPJ+Wf/GF TZ/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=sPeJrkDpwAdHvw4deiTFcz7gsv0y5iKJseJDoGuYWeU=; b=d6bn30e1iimS3OXmtImbLFaLO/wNzS8amr71y3k8CIINgUB6Q5teMTfadxYHhNTIrQ HwqfGTNDo5ZBGLaDbFkx3ElE9yS8DJ1kFxBeFh+/NXchdBWU4kZK+vDQxnjK027C0cPo yBn/8fMgNVdQD7SBgpKSeL/a1+sn7ywJNBMdL5yiL47kf5NFxKAUF87uVOl0usHUO6E2 f68qRP6FPu9/OnPDYgquDH+gKNjwWNZcmmjFx/cAFrrtwO4mOtPWDxSy9WyEqZj9sk5f N4ELvhD/RBzaEiylgS9iLiLgBrcclA8eVeaV19GrryRV/gVRXjLmo9GBjMWgZxhnnUq/ e9tQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si2112029edo.6.2020.04.23.16.14.48; Thu, 23 Apr 2020 16:15:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729036AbgDWXMK (ORCPT + 99 others); Thu, 23 Apr 2020 19:12:10 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50120 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728520AbgDWXGv (ORCPT ); Thu, 23 Apr 2020 19:06:51 -0400 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jRkvX-0004lh-Uh; Fri, 24 Apr 2020 00:06:40 +0100 Received: from ben by deadeye with local (Exim 4.93) (envelope-from ) id 1jRkvT-00E6to-Rz; Fri, 24 Apr 2020 00:06:35 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , syzbot+dc9071cc5a85950bdfce@syzkaller.appspotmail.com, "David S. Miller" , "Eric Dumazet" Date: Fri, 24 Apr 2020 00:06:30 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 163/245] pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.83-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit d9e15a2733067c9328fb56d98fe8e574fa19ec31 upstream. As diagnosed by Florian : If TCA_FQ_QUANTUM is set to 0x80000000, fq_deueue() can loop forever in : if (f->credit <= 0) { f->credit += q->quantum; goto begin; } ... because f->credit is either 0 or -2147483648. Let's limit TCA_FQ_QUANTUM to no more than 1 << 20 : This max value should limit risks of breaking user setups while fixing this bug. Fixes: afe4fd062416 ("pkt_sched: fq: Fair Queue packet scheduler") Signed-off-by: Eric Dumazet Diagnosed-by: Florian Westphal Reported-by: syzbot+dc9071cc5a85950bdfce@syzkaller.appspotmail.com Signed-off-by: David S. Miller [bwh: Backported to 3.16: Drop call to NL_SET_ERR_MSG_MOD() as extack is not supported.] Signed-off-by: Ben Hutchings --- --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c @@ -690,7 +690,7 @@ static int fq_change(struct Qdisc *sch, if (tb[TCA_FQ_QUANTUM]) { u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); - if (quantum > 0) + if (quantum > 0 && quantum <= (1 << 20)) q->quantum = quantum; else err = -EINVAL;