Commit 52ea3a56 authored by Minoru Usui's avatar Minoru Usui Committed by David S. Miller
Browse files

cls_cgroup: Fix oops when user send improperly 'tc filter add' request

I found a bug in cls_cgroup_change() in cls_cgroup.c.
cls_cgroup_change() expected tca[TCA_OPTIONS] was set from user space properly,
but tc in iproute2-2.6.29-1 (which I used) didn't set it.

In the current source code of tc in git, it set tca[TCA_OPTIONS].

  git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git



If we always use a newest iproute2 in git when we use cls_cgroup, 
we don't face this oops probably.
But I think, kernel shouldn't panic regardless of use program's behaviour. 

Signed-off-by: default avatarMinoru Usui <usui@mxm.nes.nec.co.jp>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fdd7b4c3
...@@ -167,6 +167,9 @@ static int cls_cgroup_change(struct tcf_proto *tp, unsigned long base, ...@@ -167,6 +167,9 @@ static int cls_cgroup_change(struct tcf_proto *tp, unsigned long base,
struct tcf_exts e; struct tcf_exts e;
int err; int err;
if (!tca[TCA_OPTIONS])
return -EINVAL;
if (head == NULL) { if (head == NULL) {
if (!handle) if (!handle)
return -EINVAL; return -EINVAL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment