提交 9cc63db5 编写于 作者: C Cong Wang 提交者: David S. Miller

net_sched: cancel nest attribute on failure in tcf_exts_dump()

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: NCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: NCong Wang <cwang@twopensource.com>
Signed-off-by: NJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4bbe3f5c
...@@ -561,13 +561,14 @@ EXPORT_SYMBOL(tcf_exts_change); ...@@ -561,13 +561,14 @@ EXPORT_SYMBOL(tcf_exts_change);
int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts) int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts)
{ {
#ifdef CONFIG_NET_CLS_ACT #ifdef CONFIG_NET_CLS_ACT
struct nlattr *nest;
if (exts->action && !list_empty(&exts->actions)) { if (exts->action && !list_empty(&exts->actions)) {
/* /*
* again for backward compatible mode - we want * again for backward compatible mode - we want
* to work with both old and new modes of entering * to work with both old and new modes of entering
* tc data even if iproute2 was newer - jhs * tc data even if iproute2 was newer - jhs
*/ */
struct nlattr *nest;
if (exts->type != TCA_OLD_COMPAT) { if (exts->type != TCA_OLD_COMPAT) {
nest = nla_nest_start(skb, exts->action); nest = nla_nest_start(skb, exts->action);
if (nest == NULL) if (nest == NULL)
...@@ -585,10 +586,14 @@ int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts) ...@@ -585,10 +586,14 @@ int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts)
nla_nest_end(skb, nest); nla_nest_end(skb, nest);
} }
} }
#endif
return 0; return 0;
nla_put_failure: __attribute__ ((unused))
nla_put_failure:
nla_nest_cancel(skb, nest);
return -1; return -1;
#else
return 0;
#endif
} }
EXPORT_SYMBOL(tcf_exts_dump); EXPORT_SYMBOL(tcf_exts_dump);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册