lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 21 May 2019 14:59:29 +0200
From:   Lorenzo Bianconi <lorenzo.bianconi@...hat.com>
To:     davem@...emloft.net
Cc:     netdev@...r.kernel.org, jiri@...nulli.us
Subject: [PATCH net] net: sched: sch_ingress: do not report ingress filter info in egress path

Currently if we add a filter to the ingress qdisc (e.g matchall) the
filter data are reported even in the egress path. The issue can be
triggered with the following reproducer:

$tc qdisc add dev lo ingress
$tc filter add dev lo ingress matchall action ok
$tc filter show dev lo ingress
filter protocol all pref 49152 matchall chain 0
filter protocol all pref 49152 matchall chain 0 handle 0x1
  not_in_hw
	action order 1: gact action pass
		 random type none pass val 0
		 	 index 1 ref 1 bind 1

$tc filter show dev lo egress
filter protocol all pref 49152 matchall chain 0
filter protocol all pref 49152 matchall chain 0 handle 0x1
  not_in_hw
	action order 1: gact action pass
		 random type none pass val 0
		 	 index 1 ref 1 bind 1

Fix it reporting NULL for non-ingress filters in ingress_tcf_block
routine

Fixes: 6529eaba33f0 ("net: sched: introduce tcf block infrastructure")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@...hat.com>
---
 net/sched/sch_ingress.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 0bac926b46c7..1825347fed3a 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -31,7 +31,7 @@ static struct Qdisc *ingress_leaf(struct Qdisc *sch, unsigned long arg)
 
 static unsigned long ingress_find(struct Qdisc *sch, u32 classid)
 {
-	return TC_H_MIN(classid) + 1;
+	return TC_H_MIN(classid);
 }
 
 static unsigned long ingress_bind_filter(struct Qdisc *sch,
@@ -53,7 +53,12 @@ static struct tcf_block *ingress_tcf_block(struct Qdisc *sch, unsigned long cl,
 {
 	struct ingress_sched_data *q = qdisc_priv(sch);
 
-	return q->block;
+	switch (cl) {
+	case TC_H_MIN(TC_H_MIN_INGRESS):
+		return q->block;
+	default:
+		return NULL;
+	}
 }
 
 static void clsact_chain_head_change(struct tcf_proto *tp_head, void *priv)
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ