aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_ipt.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/act_ipt.c')
-rw-r--r--net/sched/act_ipt.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index d8c9310da6e5..a9608064a4c3 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -156,10 +156,9 @@ static int tcf_ipt_init(struct rtattr *rta, struct rtattr *est,
156 rtattr_strlcpy(tname, tb[TCA_IPT_TABLE-1], IFNAMSIZ) >= IFNAMSIZ) 156 rtattr_strlcpy(tname, tb[TCA_IPT_TABLE-1], IFNAMSIZ) >= IFNAMSIZ)
157 strcpy(tname, "mangle"); 157 strcpy(tname, "mangle");
158 158
159 t = kmalloc(td->u.target_size, GFP_KERNEL); 159 t = kmemdup(td, td->u.target_size, GFP_KERNEL);
160 if (unlikely(!t)) 160 if (unlikely(!t))
161 goto err2; 161 goto err2;
162 memcpy(t, td, td->u.target_size);
163 162
164 if ((err = ipt_init_target(t, tname, hook)) < 0) 163 if ((err = ipt_init_target(t, tname, hook)) < 0)
165 goto err3; 164 goto err3;
@@ -256,13 +255,12 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
256 ** for foolproof you need to not assume this 255 ** for foolproof you need to not assume this
257 */ 256 */
258 257
259 t = kmalloc(ipt->tcfi_t->u.user.target_size, GFP_ATOMIC); 258 t = kmemdup(ipt->tcfi_t, ipt->tcfi_t->u.user.target_size, GFP_ATOMIC);
260 if (unlikely(!t)) 259 if (unlikely(!t))
261 goto rtattr_failure; 260 goto rtattr_failure;
262 261
263 c.bindcnt = ipt->tcf_bindcnt - bind; 262 c.bindcnt = ipt->tcf_bindcnt - bind;
264 c.refcnt = ipt->tcf_refcnt - ref; 263 c.refcnt = ipt->tcf_refcnt - ref;
265 memcpy(t, ipt->tcfi_t, ipt->tcfi_t->u.user.target_size);
266 strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name); 264 strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name);
267 265
268 RTA_PUT(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t); 266 RTA_PUT(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t);