From: Li Wei <lw@cn•fujitsu.com>
To: Stephen Hemminger <shemminger@vyatta•com>
Cc: netdev <netdev@vger•kernel.org>
Subject: [PATCH] tc: filter: validate filter priority in userspace.
Date: Tue, 10 Jul 2012 16:45:28 +0800 [thread overview]
Message-ID: <4FFBEBA8.1050802@cn.fujitsu.com> (raw)
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(-)
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;
--
1.7.1
next reply other threads:[~2012-07-10 8:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-10 8:45 Li Wei [this message]
2012-07-10 22:39 ` [PATCH] tc: filter: validate filter priority in userspace Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FFBEBA8.1050802@cn.fujitsu.com \
--to=lw@cn$(echo .)fujitsu.com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=shemminger@vyatta$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox