[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <492C4C8A.9000202@trash.net>
Date: Tue, 25 Nov 2008 20:05:46 +0100
From: Patrick McHardy <kaber@...sh.net>
To: Stephen Hemminger <shemminger@...tta.com>
CC: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 1b/2] tc: check for errors in gen_rate_estimator creation
Stephen Hemminger wrote:
> The functions gen_new_estimator and gen_replace_estimator can return errors,
> but they were being ignored.
>
> Signed-off-by: Stephen Hemminger <shemminger@...tta.com>
>
>
> ---
> --- a/net/sched/sch_api.c 2008-11-25 10:51:47.000000000 -0800
> +++ b/net/sched/sch_api.c 2008-11-25 10:54:16.000000000 -0800
> @@ -887,6 +887,14 @@ static int qdisc_change(struct Qdisc *sc
> return err;
> }
>
> + if (tca[TCA_RATE]) {
> + err = gen_replace_estimator(&sch->bstats, &sch->rate_est,
> + qdisc_root_sleeping_lock(sch),
> + tca[TCA_RATE]);
> + if (err)
> + return err;
This appears to have the same problem as in HFSC unless I missed more
code movement - changes to the qdisc have already been performed.
> --- a/net/sched/sch_hfsc.c 2008-11-25 10:51:47.000000000 -0800
> +++ b/net/sched/sch_hfsc.c 2008-11-25 10:54:16.000000000 -0800
> @@ -1018,6 +1018,14 @@ hfsc_change_class(struct Qdisc *sch, u32
> }
> cur_time = psched_get_time();
>
> + if (tca[TCA_RATE]) {
> + err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
> + qdisc_root_sleeping_lock(sch),
> + tca[TCA_RATE]);
> + if (err)
> + return err;
> + }
> +
> sch_tree_lock(sch);
> if (rsc != NULL)
> hfsc_change_rsc(cl, rsc, cur_time);
> @@ -1034,10 +1042,6 @@ hfsc_change_class(struct Qdisc *sch, u32
> }
> sch_tree_unlock(sch);
>
> - if (tca[TCA_RATE])
> - gen_replace_estimator(&cl->bstats, &cl->rate_est,
> - qdisc_root_sleeping_lock(sch),
> - tca[TCA_RATE]);
> return 0;
> }
There's a gen_new_estimator() a few lines below that is still unchecked.
The remaining ones look fine.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists