naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

Blame SOURCES/0143-tc-don-t-accept-qdisc-handle-greater-than-ffff.patch

4aca6e
From d97d0e6a5201c5c7d5a2019bd3c3a29b3b78d7d4 Mon Sep 17 00:00:00 2001
4aca6e
From: Davide Caratti <dcaratti@redhat.com>
4aca6e
Date: Tue, 17 Jan 2017 14:40:44 +0100
4aca6e
Subject: [PATCH] tc: don't accept qdisc 'handle' greater than ffff
4aca6e
4aca6e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1375393
4aca6e
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12376479
4aca6e
Tested: on local VM (verified error message in case 'handle' is greater than ffff)
4aca6e
Upstream Status: iproute2.git commit 087dec7fcfb1
4aca6e
4aca6e
commit 087dec7fcfb18fc4e8a0ec68c9c0a84cb9f03e69
4aca6e
Author: Davide Caratti <dcaratti@redhat.com>
4aca6e
Date:   Fri Sep 16 10:30:00 2016 +0200
4aca6e
4aca6e
    tc: don't accept qdisc 'handle' greater than ffff
4aca6e
4aca6e
    since get_qdisc_handle() truncates the input value to 16 bit, return an
4aca6e
    error and prompt "invalid qdisc ID" in case input 'handle' parameter needs
4aca6e
    more than 16 bit to be stored.
4aca6e
4aca6e
    Signed-off-by: Davide Caratti <dcaratti@redhat.com>
4aca6e
    Acked-by: Phil Sutter <phil@nwl.cc>
4aca6e
4aca6e
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
4aca6e
---
4aca6e
 tc/tc_util.c | 2 +-
4aca6e
 1 file changed, 1 insertion(+), 1 deletion(-)
4aca6e
4aca6e
diff --git a/tc/tc_util.c b/tc/tc_util.c
4aca6e
index 8114c97..df81c46 100644
4aca6e
--- a/tc/tc_util.c
4aca6e
+++ b/tc/tc_util.c
4aca6e
@@ -48,7 +48,7 @@ int get_qdisc_handle(__u32 *h, const char *str)
4aca6e
 	if (strcmp(str, "none") == 0)
4aca6e
 		goto ok;
4aca6e
 	maj = strtoul(str, &p, 16);
4aca6e
-	if (p == str)
4aca6e
+	if (p == str || maj >= (1 << 16))
4aca6e
 		return -1;
4aca6e
 	maj <<= 16;
4aca6e
 	if (*p != ':' && *p!=0)
4aca6e
-- 
4aca6e
1.8.3.1
4aca6e