aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_htb.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-23 23:33:32 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:18 -0500
commitcee63723b358e594225e812d6e14a2a0abfd5c88 (patch)
tree847f929e0f445cca8cdf55d7c17a56b0d0f2ec68 /net/sched/sch_htb.c
parentab27cfb85c5778400740ad0c401bde65616774eb (diff)
[NET_SCHED]: Propagate nla_parse return value
nla_parse() returns more detailed errno codes, propagate them back on error. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r--net/sched/sch_htb.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 3b3ff641b6d7..512df9a0a242 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -997,9 +997,17 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt)
997 struct htb_sched *q = qdisc_priv(sch); 997 struct htb_sched *q = qdisc_priv(sch);
998 struct nlattr *tb[TCA_HTB_INIT + 1]; 998 struct nlattr *tb[TCA_HTB_INIT + 1];
999 struct tc_htb_glob *gopt; 999 struct tc_htb_glob *gopt;
1000 int err;
1000 int i; 1001 int i;
1001 if (!opt || nla_parse_nested(tb, TCA_HTB_INIT, opt, NULL) || 1002
1002 tb[TCA_HTB_INIT] == NULL || 1003 if (!opt)
1004 return -EINVAL;
1005
1006 err = nla_parse_nested(tb, TCA_HTB_INIT, opt, NULL);
1007 if (err < 0)
1008 return err;
1009
1010 if (tb[TCA_HTB_INIT] == NULL ||
1003 nla_len(tb[TCA_HTB_INIT]) < sizeof(*gopt)) { 1011 nla_len(tb[TCA_HTB_INIT]) < sizeof(*gopt)) {
1004 printk(KERN_ERR "HTB: hey probably you have bad tc tool ?\n"); 1012 printk(KERN_ERR "HTB: hey probably you have bad tc tool ?\n");
1005 return -EINVAL; 1013 return -EINVAL;
@@ -1302,8 +1310,15 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1302 struct tc_htb_opt *hopt; 1310 struct tc_htb_opt *hopt;
1303 1311
1304 /* extract all subattrs from opt attr */ 1312 /* extract all subattrs from opt attr */
1305 if (!opt || nla_parse_nested(tb, TCA_HTB_RTAB, opt, NULL) || 1313 if (!opt)
1306 tb[TCA_HTB_PARMS] == NULL || 1314 goto failure;
1315
1316 err = nla_parse_nested(tb, TCA_HTB_RTAB, opt, NULL);
1317 if (err < 0)
1318 goto failure;
1319
1320 err = -EINVAL;
1321 if (tb[TCA_HTB_PARMS] == NULL ||
1307 nla_len(tb[TCA_HTB_PARMS]) < sizeof(*hopt)) 1322 nla_len(tb[TCA_HTB_PARMS]) < sizeof(*hopt))
1308 goto failure; 1323 goto failure;
1309 1324