Skip to content
Commit 12186be7 authored by Minoru Usui's avatar Minoru Usui Committed by David S. Miller
Browse files

net_cls: fix unconfigured struct tcf_proto keeps chaining and avoid kernel...


net_cls: fix unconfigured struct tcf_proto keeps chaining and avoid kernel panic when we use cls_cgroup

This patch fixes a bug which unconfigured struct tcf_proto keeps
chaining in tc_ctl_tfilter(), and avoids kernel panic in
cls_cgroup_classify() when we use cls_cgroup.

When we execute 'tc filter add', tcf_proto is allocated, initialized
by classifier's init(), and chained.  After it's chained,
tc_ctl_tfilter() calls classifier's change().  When classifier's
change() fails, tc_ctl_tfilter() does not free and keeps tcf_proto.

In addition, cls_cgroup is initialized in change() not in init().  It
accesses unconfigured struct tcf_proto which is chained before
change(), then hits Oops.

Signed-off-by: default avatarMinoru Usui <usui@mxm.nes.nec.co.jp>
Signed-off-by: default avatarJarek Poplawski <jarkao2@gmail.com>
Signed-off-by: default avatarJamal Hadi Salim <hadi@cyberus.ca>
Tested-by: default avatarMinoru Usui <usui@mxm.nes.nec.co.jp>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ea30e119
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