Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp333097pxj; Tue, 18 May 2021 04:34:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSV4vTHWxg7ICBU+SpS+ERvlVQdQQmbKcQ3I7kyW5nJncT5KObzI3KBY4ZbFOZfmRDq0Z3 X-Received: by 2002:a05:6638:2410:: with SMTP id z16mr4998210jat.130.1621337664818; Tue, 18 May 2021 04:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621337664; cv=none; d=google.com; s=arc-20160816; b=g/n0EJH0UImX2w4PjBlBW+52hnIBNaY4JGXpuzW2sWPLtP7X8P8c5hHH1EFsLBfiNQ FZXKDi9dOyrgFpCsqZTm9SekteRTDvnl331JhclxsjQXa4DpHHH86NJoMCrBayFzZg94 Gi6LUWKG0KbaY8LO6/gi42aFwmQmLsEq/J9hJGLdoG7jntugrtsGgTbFA/xjo0EbTqAJ 68c4wzReAA9R2/8xoZyJT4NdlIHkhSE6VorknkRQVwF7ngmjw80uhptp4A/D8rIwinWS wubDw7YtrnF6HbfFujZpAUsk3yp5cCNaTbexvPMKnR7iWFtxQRkJX8KTpeCSmBniwqpS mTIQ== 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=ILPrJukFesFgOOpKmGfHcbCMLkBODhYVaHMfb19O2HY=; b=pZhnaQ4ofVdHgOcZF7802OxDxCKJqBg//vdBEjEiI71eHSDr1nxHdw2UDtLGs4L4XV sfRAuGZ/YgIwEFqMKIOJVyw6lkOJc37V/YFmez4Rri3Jy1TW8mxQLbQJxuGzupXrHqKh PCFtxHMhkftsQKAaETYXlAqI3cg6KFL9U5gwlp+hTMuyWaH8X27ntHrKpGnA844d5ARQ SifO7wSwCLfWmcT+Pmgq2yR7e+pyolfapQgJcwrpBmhtplQBgE+8hIHpNgjGVWJ2ZNpX zvdE5HdAhu1xby8Q79yer6iOyInaH+zzBR+3CAl1bzf46xTZaK/+j0wMC2hepu0VANRD aGuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C1PCljp7; 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 b18si6661403ils.16.2021.05.18.04.34.11; Tue, 18 May 2021 04:34:24 -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=C1PCljp7; 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 S244744AbhEQPVy (ORCPT + 99 others); Mon, 17 May 2021 11:21:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:48550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243121AbhEQPJO (ORCPT ); Mon, 17 May 2021 11:09:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3595561C36; Mon, 17 May 2021 14:30:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261811; bh=c9WwFmxOBLGRwULHcpIEda+vh5qxPYLJGDW6aHdicYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C1PCljp77EiOh+Va3u0qOR2f8HETbRDQsS6ApO0Ao0P8jakmS+fZcaDdbSXql03v4 oayc+kkKH2lCoNryuptuAlFBXnClhJ/56/zDjFJDOxxSJ6NoBo/1Mp+yDTkiLJde6i /Gd86vd8ChumlnHq3Uzcq+oG8vQDwZ9Nx+4ov2fU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+d50710fd0873a9c6b40c@syzkaller.appspotmail.com, Du Cheng , Cong Wang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 070/289] net: sched: tapr: prevent cycle_time == 0 in parse_taprio_schedule Date: Mon, 17 May 2021 15:59:55 +0200 Message-Id: <20210517140307.556188282@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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: Du Cheng [ Upstream commit ed8157f1ebf1ae81a8fa2653e3f20d2076fad1c9 ] There is a reproducible sequence from the userland that will trigger a WARN_ON() condition in taprio_get_start_time, which causes kernel to panic if configured as "panic_on_warn". Catch this condition in parse_taprio_schedule to prevent this condition. Reported as bug on syzkaller: https://syzkaller.appspot.com/bug?extid=d50710fd0873a9c6b40c Reported-by: syzbot+d50710fd0873a9c6b40c@syzkaller.appspotmail.com Signed-off-by: Du Cheng Acked-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sched/sch_taprio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index c966c05a0be9..00853065dfa0 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -900,6 +900,12 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb, list_for_each_entry(entry, &new->entries, list) cycle = ktime_add_ns(cycle, entry->interval); + + if (!cycle) { + NL_SET_ERR_MSG(extack, "'cycle_time' can never be 0"); + return -EINVAL; + } + new->cycle_time = cycle; } -- 2.30.2