Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2459322imd; Fri, 2 Nov 2018 11:46:22 -0700 (PDT) X-Google-Smtp-Source: AJdET5digUtTe7uLwVVBkk/dWgNjSiWhliQerLi1BPpv+YSF+SY/GCXLEUbhVqPyYw1ZJsZCsLUS X-Received: by 2002:a17:902:8504:: with SMTP id bj4-v6mr8945446plb.99.1541184382944; Fri, 02 Nov 2018 11:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184382; cv=none; d=google.com; s=arc-20160816; b=VAGYVuLBZMZsbgnt/a+yK0WUxtqPy3o8Cmh0yPwsOVUG79W3mqaUJZ7ulHYbkngjqT JW0dEB32lQ5WOtm+rvV0QS0GNLKBRjm9dRvZYF95uRZIyloMDflZFVqRwfD9RpSccYig oxh+iMr7IUDfmtYwEh5UrMySmRfoRHG04n0JvQC1BwmYA9KqAX3dGO8EPboH+DGB0MP3 +I+Yuusquk6toCCvgovQpn5zm5AriFpkh/2RdXlwn8j183OT5epfBlM93ZjHvQhuyZ6d OgArQ36p776PKKETm+ZeUWHvZ3aylXwoNyf4GouDxObo6KejT0c4VyaNZVetJtuvICeR XaeQ== 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=JEARSlNBPcX8Ds+Sl6SYOYMnsH/rTv3yFP7csN7LojE=; b=nwTi1V/HYHs8B4oMCDHwHWE97EeY06khgtc/Of/+qhM/31wNp3Qukbz7yc9wM/oCES dRjgL3Cin4CD4bzj3l+oItThxowVTIAqJas9oLkr4F/oEYdnLrrQR0O0y6byxkSnEOO9 +pB86z4RXwF03MVyJuWawHrH7wDllGcTzKD0rejtel0VkgtPTTgYK/HaqKjQ5nOdwwiT oBJVF4l8lZzh+JgQsEaByDHi2m7XHMDryOoBCdyzgWtp09+C3+jwzLBC6gsTKXzNi1it K9SJVvFmmp1YAa2NTG4iguVkZsbFLsgY8vjuel8rQP6+ME10EjDIYdO/yaiO5AlddbIK M2uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2U8lbPiI; 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 b2-v6si14254658pgg.412.2018.11.02.11.46.07; Fri, 02 Nov 2018 11:46:22 -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=2U8lbPiI; 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 S1730131AbeKCDxQ (ORCPT + 99 others); Fri, 2 Nov 2018 23:53:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:48846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728985AbeKCDxQ (ORCPT ); Fri, 2 Nov 2018 23:53:16 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.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 1985920847; Fri, 2 Nov 2018 18:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184303; bh=1M66SYwmqLjapjgIw48igjkOhS6zjjBIdzYu/Va8F+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2U8lbPiI9QRB9vkqgR3EZfdhgHCDXlAhFrLea9YrKOUcIZ3fQOvm/WdJNwRqIRpX/ 2VD9o6JSyOeflMel0rRLhL9AhIpgBOqVrOcpGI74q+C9T6uMr/jLrbbGTDSpfORgK+ zjKuyylWuAJiTlVIf7u/oV+wUT0AlgoRodFBcSuY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Sutter , Jiri Pirko , Eric Dumazet , "David S. Miller" Subject: [PATCH 4.18 129/150] net: sched: Fix for duplicate class dump Date: Fri, 2 Nov 2018 19:34:51 +0100 Message-Id: <20181102182911.782902628@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Phil Sutter [ Upstream commit 3c53ed8fef6881a864f0ee8240ed2793ef73ad0d ] When dumping classes by parent, kernel would return classes twice: | # tc qdisc add dev lo root prio | # tc class show dev lo | class prio 8001:1 parent 8001: | class prio 8001:2 parent 8001: | class prio 8001:3 parent 8001: | # tc class show dev lo parent 8001: | class prio 8001:1 parent 8001: | class prio 8001:2 parent 8001: | class prio 8001:3 parent 8001: | class prio 8001:1 parent 8001: | class prio 8001:2 parent 8001: | class prio 8001:3 parent 8001: This comes from qdisc_match_from_root() potentially returning the root qdisc itself if its handle matched. Though in that case, root's classes were already dumped a few lines above. Fixes: cb395b2010879 ("net: sched: optimize class dumps") Signed-off-by: Phil Sutter Reviewed-by: Jiri Pirko Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -2052,7 +2052,8 @@ static int tc_dump_tclass_root(struct Qd if (tcm->tcm_parent) { q = qdisc_match_from_root(root, TC_H_MAJ(tcm->tcm_parent)); - if (q && tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0) + if (q && q != root && + tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0) return -1; return 0; }