Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp171974pxj; Tue, 18 May 2021 00:14:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywSIyuu1PpvJ20xnFu6iBH5OvDiXn9bXfSMiY0gN/ov+Y7KkoF6HhIEDoDhrbysATenycZ X-Received: by 2002:a02:83c2:: with SMTP id j2mr4099544jah.6.1621322084214; Tue, 18 May 2021 00:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621322084; cv=none; d=google.com; s=arc-20160816; b=E9ODpc3S0Gcc+E7cuS0aXLdmvNKUhgIrVgWgW7S3uWEzaKlkE20Fn+i5HndSx6lc6F 7To686LjcDZmlzrGhDztmBuw+e3ag+9JXJLeye6EoickNL1/fN3Yi7Ma40vgoHLiAwhM By45qc0+Xq44V/GfUD337fOrVRjvEtFWG7qyYCDoynWkgA45lY51yW2hAVsQfORFDRBC rPCp5RFAR4MqZkVw5iyLylQ1ze+36XKTazoqt2rYYcCDp+fnvl4HN5XbJDE+uh6BZdi8 /A72tXV7ZZlsoROVYWB7nwZukJwaVRlOrPO05YohoO/iZP+KN/rCdYOaSUUG0K++cgRE CshQ== 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=yOr1fVWQoFRuqoSWTfnyVSnHICegG5iwchgGs0avtVE=; b=CYCRg/uc0260khGbwMKbkN9bZxHA0PXF7+xVPOreic+HmxkwsIWkkep9ZXN626m9SK TBxmDi/TKZHQN0daLs+qGIPP2WNH+fx9T7DkIzkOuXXPTPb8aoEk5qz7aO75adUGdHAR HYMecSdNcpYVjB/ndm5Q4qNEXk+u5B2pfdmUChPh9qqq02QpdfdYx4AoRiowYN+N83wW Jtm2T10APauNj7Di9YXz72RCqzsBdepb1Nzm8wUIUZkKUerKArcoRoYvt6ady0fvwr0n 6b1oximvWh0+yNYXUKwrsVMYsjFA7jrKifd2rFBvYUemcjGDQ2juzfZbGxy1fgkS6v64 LF9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ageqpwdw; 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 d12si19458059ioi.7.2021.05.18.00.14.26; Tue, 18 May 2021 00:14:44 -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=Ageqpwdw; 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 S236891AbhEQOxI (ORCPT + 99 others); Mon, 17 May 2021 10:53:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:50944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241300AbhEQOoW (ORCPT ); Mon, 17 May 2021 10:44:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 665576195A; Mon, 17 May 2021 14:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261242; bh=eSy6zKIxXLzxOslN40huBVdUCeubKe8+1nZOsfvq3Y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgeqpwdwFC/EyEdsVIXlNGYUEgWwhPtX6V6e7xZpNqaGn3T17i+teEa+4/2F0TnbO pKvEEfHg7cwZWlPG5cTIeRHYI/FfD1E/MEL7yOs4z38O8JqLMLCc03eOccW8tn7hJt paJyRRQXnkS/AT5z7W1cytrBW5DjgTb55edyQlrA= 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.11 089/329] net: sched: tapr: prevent cycle_time == 0 in parse_taprio_schedule Date: Mon, 17 May 2021 16:00:00 +0200 Message-Id: <20210517140305.121480144@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.043055203@linuxfoundation.org> References: <20210517140302.043055203@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 6f775275826a..c70f93d64483 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