Skip to content

Commit

Permalink
net_sched: fix a regression in tc actions
Browse files Browse the repository at this point in the history
This patch fixes:
1) pass mask rather than size to tcf_hashinfo_init()
2) the cleanup should be in reversed order in mirred_cleanup_module()

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Fixes: 369ba56 ("net_sched: init struct tcf_hashinfo at register time")
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
WANG Cong authored and David S. Miller committed Dec 20, 2013
1 parent 852ad5e commit 568a153
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion net/sched/act_csum.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ MODULE_LICENSE("GPL");

static int __init csum_init_module(void)
{
int err = tcf_hashinfo_init(&csum_hash_info, CSUM_TAB_MASK+1);
int err = tcf_hashinfo_init(&csum_hash_info, CSUM_TAB_MASK);
if (err)
return err;

Expand Down
2 changes: 1 addition & 1 deletion net/sched/act_gact.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ MODULE_LICENSE("GPL");

static int __init gact_init_module(void)
{
int err = tcf_hashinfo_init(&gact_hash_info, GACT_TAB_MASK+1);
int err = tcf_hashinfo_init(&gact_hash_info, GACT_TAB_MASK);
if (err)
return err;
#ifdef CONFIG_GACT_PROB
Expand Down
2 changes: 1 addition & 1 deletion net/sched/act_ipt.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ MODULE_ALIAS("act_xt");
static int __init ipt_init_module(void)
{
int ret1, ret2, err;
err = tcf_hashinfo_init(&ipt_hash_info, IPT_TAB_MASK+1);
err = tcf_hashinfo_init(&ipt_hash_info, IPT_TAB_MASK);
if (err)
return err;

Expand Down
6 changes: 3 additions & 3 deletions net/sched/act_mirred.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static int __init mirred_init_module(void)
if (err)
return err;

err = tcf_hashinfo_init(&mirred_hash_info, MIRRED_TAB_MASK+1);
err = tcf_hashinfo_init(&mirred_hash_info, MIRRED_TAB_MASK);
if (err) {
unregister_netdevice_notifier(&mirred_device_notifier);
return err;
Expand All @@ -287,9 +287,9 @@ static int __init mirred_init_module(void)

static void __exit mirred_cleanup_module(void)
{
unregister_netdevice_notifier(&mirred_device_notifier);
tcf_hashinfo_destroy(&mirred_hash_info);
tcf_unregister_action(&act_mirred_ops);
tcf_hashinfo_destroy(&mirred_hash_info);
unregister_netdevice_notifier(&mirred_device_notifier);
}

module_init(mirred_init_module);
Expand Down
2 changes: 1 addition & 1 deletion net/sched/act_nat.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ MODULE_LICENSE("GPL");

static int __init nat_init_module(void)
{
int err = tcf_hashinfo_init(&nat_hash_info, NAT_TAB_MASK+1);
int err = tcf_hashinfo_init(&nat_hash_info, NAT_TAB_MASK);
if (err)
return err;
return tcf_register_action(&act_nat_ops);
Expand Down
2 changes: 1 addition & 1 deletion net/sched/act_pedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ MODULE_LICENSE("GPL");

static int __init pedit_init_module(void)
{
int err = tcf_hashinfo_init(&pedit_hash_info, PEDIT_TAB_MASK+1);
int err = tcf_hashinfo_init(&pedit_hash_info, PEDIT_TAB_MASK);
if (err)
return err;
return tcf_register_action(&act_pedit_ops);
Expand Down
2 changes: 1 addition & 1 deletion net/sched/act_police.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static struct tc_action_ops act_police_ops = {
static int __init
police_init_module(void)
{
int err = tcf_hashinfo_init(&police_hash_info, POL_TAB_MASK+1);
int err = tcf_hashinfo_init(&police_hash_info, POL_TAB_MASK);
if (err)
return err;
err = tcf_register_action(&act_police_ops);
Expand Down
2 changes: 1 addition & 1 deletion net/sched/act_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ MODULE_LICENSE("GPL");
static int __init simp_init_module(void)
{
int err, ret;
err = tcf_hashinfo_init(&simp_hash_info, SIMP_TAB_MASK+1);
err = tcf_hashinfo_init(&simp_hash_info, SIMP_TAB_MASK);
if (err)
return err;

Expand Down
2 changes: 1 addition & 1 deletion net/sched/act_skbedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ MODULE_LICENSE("GPL");

static int __init skbedit_init_module(void)
{
int err = tcf_hashinfo_init(&skbedit_hash_info, SKBEDIT_TAB_MASK+1);
int err = tcf_hashinfo_init(&skbedit_hash_info, SKBEDIT_TAB_MASK);
if (err)
return err;
return tcf_register_action(&act_skbedit_ops);
Expand Down

0 comments on commit 568a153

Please sign in to comment.