diff mbox

tc: filter: validate filter priority in userspace.

Message ID 4FFBEBA8.1050802@cn.fujitsu.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Wei Li July 10, 2012, 8:45 a.m. UTC
Because we use the high 16 bits of tcm_info to pass prio value to
kernel, thus it's range would be [0, 0xffff], without validation
in tc when user pass a lager(>65535) priority, the actual priority
set in kernel would confuse the user.

So, add a validation to ensure prio in the range.
---
 tc/tc_filter.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

stephen hemminger July 10, 2012, 10:39 p.m. UTC | #1
On Tue, 10 Jul 2012 16:45:28 +0800
Li Wei <lw@cn.fujitsu.com> wrote:

> 
> Because we use the high 16 bits of tcm_info to pass prio value to
> kernel, thus it's range would be [0, 0xffff], without validation
> in tc when user pass a lager(>65535) priority, the actual priority
> set in kernel would confuse the user.
> 
> So, add a validation to ensure prio in the range.

Applied
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index 207302f..04c3b82 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -105,7 +105,7 @@  int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 			NEXT_ARG();
 			if (prio)
 				duparg("priority", *argv);
-			if (get_u32(&prio, *argv, 0))
+			if (get_u32(&prio, *argv, 0) || prio > 0xFFFF)
 				invarg(*argv, "invalid priority value");
 		} else if (matches(*argv, "protocol") == 0) {
 			__u16 id;