Skip to content

Commit

Permalink
cls_cgroup: Fix oops when user send improperly 'tc filter add' request
Browse files Browse the repository at this point in the history
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: Minoru Usui <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Minoru Usui authored and davem330 committed Jun 9, 2009
1 parent fdd7b4c commit 52ea3a5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/sched/cls_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ static int cls_cgroup_change(struct tcf_proto *tp, unsigned long base,
struct tcf_exts e;
int err;

if (!tca[TCA_OPTIONS])
return -EINVAL;

if (head == NULL) {
if (!handle)
return -EINVAL;
Expand Down

0 comments on commit 52ea3a5

Please sign in to comment.