netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net-next] net_sched: cancel nest attribute on failure in tcf_exts_dump()
@ 2014-07-16 21:25 Cong Wang
  2014-07-16 21:25 ` [Patch net-next] net_sched: hold tcf_lock in netdevice notifier Cong Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Cong Wang @ 2014-07-16 21:25 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Jamal Hadi Salim, David S. Miller, Cong Wang

From: Cong Wang <cwang@twopensource.com>

Like other places, we need to cancel the nest attribute after
we start. Fortunately the netlink message will not be sent on
failure, so it's not a big problem at all.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
---
 net/sched/cls_api.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 45527e6..c28b0d3 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -561,13 +561,14 @@ EXPORT_SYMBOL(tcf_exts_change);
 int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts)
 {
 #ifdef CONFIG_NET_CLS_ACT
+	struct nlattr *nest;
+
 	if (exts->action && !list_empty(&exts->actions)) {
 		/*
 		 * again for backward compatible mode - we want
 		 * to work with both old and new modes of entering
 		 * tc data even if iproute2  was newer - jhs
 		 */
-		struct nlattr *nest;
 		if (exts->type != TCA_OLD_COMPAT) {
 			nest = nla_nest_start(skb, exts->action);
 			if (nest == NULL)
@@ -585,10 +586,14 @@ int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts)
 			nla_nest_end(skb, nest);
 		}
 	}
-#endif
 	return 0;
-nla_put_failure: __attribute__ ((unused))
+
+nla_put_failure:
+	nla_nest_cancel(skb, nest);
 	return -1;
+#else
+	return 0;
+#endif
 }
 EXPORT_SYMBOL(tcf_exts_dump);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-07-21  3:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-16 21:25 [Patch net-next] net_sched: cancel nest attribute on failure in tcf_exts_dump() Cong Wang
2014-07-16 21:25 ` [Patch net-next] net_sched: hold tcf_lock in netdevice notifier Cong Wang
2014-07-17 12:49   ` Jamal Hadi Salim
2014-07-17 16:45     ` Cong Wang
2014-07-17 18:17       ` Eric Dumazet
2014-07-17 21:25         ` Cong Wang
2014-07-18  5:37           ` Eric Dumazet
2014-07-18  5:51             ` Cong Wang
2014-07-18  7:08               ` Eric Dumazet
2014-07-19 22:02                 ` Jamal Hadi Salim
2014-07-17 23:01   ` David Miller
2014-07-21  3:31   ` David Miller
2014-07-17  6:51 ` [Patch net-next] net_sched: cancel nest attribute on failure in tcf_exts_dump() David Miller
2014-07-17 12:39 ` Jamal Hadi Salim
2014-07-17 21:59 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).