From: Thomas Graf Date: Tue, 7 Nov 2006 14:30:21 +0000 (+0100) Subject: PKT_SCHED: Fix error handling while dumping actions X-Git-Tag: v2.6.16.32-rc1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=118d32a5f209230c66a3b7d3874d1d5846ceb630;p=thirdparty%2Fkernel%2Fstable.git PKT_SCHED: Fix error handling while dumping actions "return -err" and blindly inheriting the error code in the netlink failure exception handler causes errors codes to be returned as positive value therefore making them being ignored by the caller. May lead to sending out incomplete netlink messages. Signed-off-by: Thomas Graf Signed-off-by: David S. Miller Signed-off-by: Adrian Bunk --- diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 2ffa11c6e8ded..4a1d29be0f5b5 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -251,15 +251,17 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref) RTA_PUT(skb, a->order, 0, NULL); err = tcf_action_dump_1(skb, a, bind, ref); if (err < 0) - goto rtattr_failure; + goto errout; r->rta_len = skb->tail - (u8*)r; } return 0; rtattr_failure: + err = -EINVAL; +errout: skb_trim(skb, b - skb->data); - return -err; + return err; } struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,