diff options
Diffstat (limited to 'net/sched/act_police.c')
-rw-r--r-- | net/sched/act_police.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index c0fce9b98412..ee2f1b64dd70 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -54,7 +54,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c | |||
54 | { | 54 | { |
55 | struct tcf_common *p; | 55 | struct tcf_common *p; |
56 | int err = 0, index = -1, i = 0, s_i = 0, n_i = 0; | 56 | int err = 0, index = -1, i = 0, s_i = 0, n_i = 0; |
57 | struct nlattr *r; | 57 | struct nlattr *nest; |
58 | 58 | ||
59 | read_lock_bh(&police_lock); | 59 | read_lock_bh(&police_lock); |
60 | 60 | ||
@@ -69,18 +69,19 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c | |||
69 | continue; | 69 | continue; |
70 | a->priv = p; | 70 | a->priv = p; |
71 | a->order = index; | 71 | a->order = index; |
72 | r = (struct nlattr *)skb_tail_pointer(skb); | 72 | nest = nla_nest_start(skb, a->order); |
73 | NLA_PUT(skb, a->order, 0, NULL); | 73 | if (nest == NULL) |
74 | goto nla_put_failure; | ||
74 | if (type == RTM_DELACTION) | 75 | if (type == RTM_DELACTION) |
75 | err = tcf_action_dump_1(skb, a, 0, 1); | 76 | err = tcf_action_dump_1(skb, a, 0, 1); |
76 | else | 77 | else |
77 | err = tcf_action_dump_1(skb, a, 0, 0); | 78 | err = tcf_action_dump_1(skb, a, 0, 0); |
78 | if (err < 0) { | 79 | if (err < 0) { |
79 | index--; | 80 | index--; |
80 | nlmsg_trim(skb, r); | 81 | nla_nest_cancel(skb, nest); |
81 | goto done; | 82 | goto done; |
82 | } | 83 | } |
83 | r->nla_len = skb_tail_pointer(skb) - (u8 *)r; | 84 | nla_nest_end(skb, nest); |
84 | n_i++; | 85 | n_i++; |
85 | } | 86 | } |
86 | } | 87 | } |
@@ -91,7 +92,7 @@ done: | |||
91 | return n_i; | 92 | return n_i; |
92 | 93 | ||
93 | nla_put_failure: | 94 | nla_put_failure: |
94 | nlmsg_trim(skb, r); | 95 | nla_nest_cancel(skb, nest); |
95 | goto done; | 96 | goto done; |
96 | } | 97 | } |
97 | 98 | ||