net_cls_act: act_simple dont ignore realloc code

reallocation of the policy data was being ignored. It could fail.
Simplify so that there is no need for reallocating.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Jamal Hadi Salim and committed by David S. Miller 9d1045ad 1da5ea1a

+9 -8
+9 -8
net/sched/act_simple.c
··· 79 79 return 0; 80 80 } 81 81 82 - static int realloc_defdata(struct tcf_defact *d, char *defdata) 82 + static void reset_policy(struct tcf_defact *d, char *defdata, 83 + struct tc_defact *p) 83 84 { 84 - kfree(d->tcfd_defdata); 85 - return alloc_defdata(d, defdata); 85 + spin_lock_bh(&d->tcf_lock); 86 + d->tcf_action = p->action; 87 + memset(d->tcfd_defdata, 0, SIMP_MAX_DATA); 88 + strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA); 89 + spin_unlock_bh(&d->tcf_lock); 86 90 } 87 91 88 92 static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = { ··· 133 129 kfree(pc); 134 130 return ret; 135 131 } 132 + d->tcf_action = parm->action; 136 133 ret = ACT_P_CREATED; 137 134 } else { 138 135 d = to_defact(pc); ··· 141 136 tcf_simp_release(d, bind); 142 137 return -EEXIST; 143 138 } 144 - realloc_defdata(d, defdata); 139 + reset_policy(d, defdata, parm); 145 140 } 146 - 147 - spin_lock_bh(&d->tcf_lock); 148 - d->tcf_action = parm->action; 149 - spin_unlock_bh(&d->tcf_lock); 150 141 151 142 if (ret == ACT_P_CREATED) 152 143 tcf_hash_insert(pc, &simp_hash_info);