[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <492C43DF.1040703@trash.net>
Date: Tue, 25 Nov 2008 19:28:47 +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 1/2] tc: check for errors from gen_replace_estimator
Stephen Hemminger wrote:
> gen_replace_estimator can return errors, but they were being ignored.
>
> --- a/net/sched/sch_hfsc.c 2008-11-25 10:02:05.000000000 -0800
> +++ b/net/sched/sch_hfsc.c 2008-11-25 10:07:21.000000000 -0800
> @@ -1035,10 +1035,10 @@ hfsc_change_class(struct Qdisc *sch, u32
> sch_tree_unlock(sch);
>
> if (tca[TCA_RATE])
> - gen_replace_estimator(&cl->bstats, &cl->rate_est,
> + err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
> qdisc_root_sleeping_lock(sch),
> tca[TCA_RATE]);
> - return 0;
> + return err;
At this point we've already made changes to the class, so
returning an error without undoing them is wrong.
I'd suggest to move the estimator replacement up a bit, the
other changes can't fail.
There's also gen_new_estimator() that should be treated
similary for consistency.
--
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