Davide Caratti <dcara...@redhat.com> writes: > when the following command > > # tc actions replace action vlan pop index 100 > > is run for the first time, and tcf_vlan_init() fails allocating struct > tcf_vlan_params, tcf_vlan_cleanup() calls kfree_rcu(NULL, ...). This causes > the following error: >
[...] > fix this in tcf_vlan_cleanup(), ensuring that kfree_rcu(p, ...) is called > only when p is not NULL. > > Fixes: 4c5b9d9642c8 ("act_vlan: VLAN action rewrite to use RCU lock/unlock > and update") > Signed-off-by: Davide Caratti <dcara...@redhat.com> > --- > net/sched/act_vlan.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c > index e1a1b3f3983a..c2914e9a4a6f 100644 > --- a/net/sched/act_vlan.c > +++ b/net/sched/act_vlan.c > @@ -225,7 +225,8 @@ static void tcf_vlan_cleanup(struct tc_action *a) > struct tcf_vlan_params *p; > > p = rcu_dereference_protected(v->vlan_p, 1); > - kfree_rcu(p, rcu); > + if (p) > + kfree_rcu(p, rcu); > } > > static int tcf_vlan_dump(struct sk_buff *skb, struct tc_action *a, Good catch. I think you can propagate the fix on the other actions ->cleanup(), where private parameters structure may not be present at cleanup time, e.g. csum, ife.