Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6237797ybe; Tue, 17 Sep 2019 23:34:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGW7l1j42Hhs5dRIXrrOnRNEJ4SoWN+t70FnS31BrxzOmjU9yuxzOkqRwG15idGdb3B5FD X-Received: by 2002:a50:de08:: with SMTP id z8mr8580802edk.121.1568788440004; Tue, 17 Sep 2019 23:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568788439; cv=none; d=google.com; s=arc-20160816; b=ShB1K6YFreW5P5hMEUMaqfb/ZotKvAfxFwdH4xv2jOU+/NKOAIqSni24+6X20JuGHZ laUsmfOJ5LCQxHjJd+4FOSL5yUfVnKK7NfSSfXGKBiYzClzZxFmAW7cgXi65aDH5YuZZ g1fJE4QnLLwUB9ZeFsOZ6Maagk9VoTw+cd0DfRGpq1lu22iP4ET2y8XMxWHv7NutcHS1 Gk6QjrXJtFM5viEJN2GHgCj27VdG5vyAvjVjbnJEHuud2Wx/jMoLOMDoLlgCAw/9WLFP D0wD1eWrfLIxAXAVF1FdfvH7Nk+/+gMbM+23kUhKSKmVG5KjZ6DX8XanqN/fEjWPJlYy AvVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c0PGRn2rmDQXAh8PCLAkBBuXhMvno/VU1ibAzZKqKgs=; b=YYNbURDWvMi4zffRVwGZlyplaTL+7A3khVFy/oJeMPCepcnsvmJjobQqJxeFCc+uUQ 1vgSaGcJYR0pz4fDDv4EBTsRTZfLcd+qjADoaBHgC17UtKCZWXWuyfeqG3bZBYDB0qeB Zk5u9YkMsfleWy5j4WXftRF/ScDOVoYIVQTwLKgCszJX2hg/on+VjxQYvxh0iAC6eOt4 rvspPXOJujrJLyQsNGvwubJPZEwCHOPicZietXPJ56JVLB4yOriEw9/wmYtXmNo2qEL0 Ic40O+Vx94LhSvZ9wYvytERQPIIk9zS001oWlzIQOFVx4nJPEzcdbrvjFjai5JipG2v0 4/JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RLkuLJK8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g40si2732198edg.397.2019.09.17.23.33.37; Tue, 17 Sep 2019 23:33:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RLkuLJK8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729872AbfIRGam (ORCPT + 99 others); Wed, 18 Sep 2019 02:30:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:44838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729820AbfIRGYV (ORCPT ); Wed, 18 Sep 2019 02:24:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B117D21924; Wed, 18 Sep 2019 06:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568787861; bh=wi4Cfyhc5EMTiYmrakDGIzbIOsQrdbs/a584aA+7zOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RLkuLJK8ksGK/JJ+5IYBCStkGsQVp46QBn2sISeVuYYfCFdlN0fChGil1dJ/CoNc2 y+pRZMLmC9DhC2m+K80Pn3urstCZbTA2u0kYh0gGXsICAxmdB4nSOOjNBLCU7Oiau8 gZjWVFa2J9GgzML5expJzlphaUYJ7nQS0u+06d1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+bc6297c11f19ee807dc2@syzkaller.appspotmail.com, syzbot+041483004a7f45f1f20a@syzkaller.appspotmail.com, syzbot+55be5f513bed37fc4367@syzkaller.appspotmail.com, Jamal Hadi Salim , Jiri Pirko , Terry Lam , Cong Wang , "David S. Miller" Subject: [PATCH 5.2 11/85] sch_hhf: ensure quantum and hhf_non_hh_weight are non-zero Date: Wed, 18 Sep 2019 08:18:29 +0200 Message-Id: <20190918061234.493420947@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190918061234.107708857@linuxfoundation.org> References: <20190918061234.107708857@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cong Wang [ Upstream commit d4d6ec6dac07f263f06d847d6f732d6855522845 ] In case of TCA_HHF_NON_HH_WEIGHT or TCA_HHF_QUANTUM is zero, it would make no progress inside the loop in hhf_dequeue() thus kernel would get stuck. Fix this by checking this corner case in hhf_change(). Fixes: 10239edf86f1 ("net-qdisc-hhf: Heavy-Hitter Filter (HHF) qdisc") Reported-by: syzbot+bc6297c11f19ee807dc2@syzkaller.appspotmail.com Reported-by: syzbot+041483004a7f45f1f20a@syzkaller.appspotmail.com Reported-by: syzbot+55be5f513bed37fc4367@syzkaller.appspotmail.com Cc: Jamal Hadi Salim Cc: Jiri Pirko Cc: Terry Lam Signed-off-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_hhf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sched/sch_hhf.c +++ b/net/sched/sch_hhf.c @@ -531,7 +531,7 @@ static int hhf_change(struct Qdisc *sch, new_hhf_non_hh_weight = nla_get_u32(tb[TCA_HHF_NON_HH_WEIGHT]); non_hh_quantum = (u64)new_quantum * new_hhf_non_hh_weight; - if (non_hh_quantum > INT_MAX) + if (non_hh_quantum == 0 || non_hh_quantum > INT_MAX) return -EINVAL; sch_tree_lock(sch);