Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3010673pxj; Mon, 17 May 2021 15:30:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxLacwf+7M8zYU+g7stSl9T97pF2Gb0DpGTm154xeiMFndFlFTGVs/9vLJ1MG+6wqpT2lI X-Received: by 2002:a05:6402:2788:: with SMTP id b8mr2875518ede.140.1621290637545; Mon, 17 May 2021 15:30:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621290637; cv=none; d=google.com; s=arc-20160816; b=S1Bh2ILU+PomzYoavuZp3XuGjWCePOPOvHYo7T9snURuyDWx5H6y6NZmqHOavi2cCk j6lDwd9Ai1hnEQLIn6m0xp/I2FOn5ZbC4Z9gL+tDE5qMYKFU4YUnyO3sc42ajfSdbWV/ jgRO63t7rqR3kzLsYq2vfKdBFP2zF6telCFqfUcsYHz6ZQ3gKQaJJg47Kglal8pEXZq1 4DkvA+tsF9zi67z/KFAjZ/XJOwtQPBei8C2W5rbSRbfMH/Z47/0F4CofN3mBkKVAxlkN S+/FP5uGLYQ/6bJ+kMmqnjlsTymARxY48v3SleKoVm1Rv1r8zpYVebGL5kzBcsbO22D+ wYQQ== 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=pHoh3ZeVteZuBBnV0Utw2hOFyJjEZf7VYaIciVqIpuo=; b=On2EVEYZSLckLVm9W0jld3Qo3zYlm7Ynwrfx3YQoyEDJZVQUgn3NM3zW9FgRp4pPHZ IiXTCeVAyIKECcBhnsAM4vJqDdpZiuNK+y8EeBk61yF/e8pt4k6cWlDMBFxpXbtPsMFL keQQZhhotzhGHI92JwUtF7RrQbawm/6KOTi7+QM985pRHZdwk3rklqn/M/9Rq8OFWqLZ hC89/ANG2GQjaAT2+bjvgnky4Z3ohdjDttS7v9gbruEv8k7Hh98aMqYSnTvSAg5dQ5Bu 5ZMj/QExxm7nq5MpSVCVLxs+CGS76lzmM24BNwyhaDQYFEcdYam5NOKZPiPl+3zNvxT9 viyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="LOOB/rm4"; 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 bm2si16403491ejb.470.2021.05.17.15.30.13; Mon, 17 May 2021 15:30:37 -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="LOOB/rm4"; 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 S238690AbhEQOOB (ORCPT + 99 others); Mon, 17 May 2021 10:14:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:60382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238700AbhEQOMD (ORCPT ); Mon, 17 May 2021 10:12:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 17828613CA; Mon, 17 May 2021 14:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260480; bh=+Lb80RiCQ4DsnEB3+qdr0F/sCYz07DzZ2ogEYRtlZ3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LOOB/rm4ecPahm4sbijaZrjlISjCijxIGgVGro+GlYHKwGzuRZc14vk7i9gFZpxMr xNSVUEuwV9+JK7EfBnXQoeesnwTt2cJsu49zTTkR0N4WvIe8WlY7HkfI+5cs8hmWJr i82+V4N6VyiTVKp+VVgHknAbE7hbFzxo6CvIIoDs= 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.12 099/363] net: sched: tapr: prevent cycle_time == 0 in parse_taprio_schedule Date: Mon, 17 May 2021 15:59:25 +0200 Message-Id: <20210517140305.936202085@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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 8287894541e3..909c798b7403 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -901,6 +901,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