From: Eric Dumazet Date: Fri, 23 Feb 2018 03:45:27 +0000 (-0800) Subject: net_sched: gen_estimator: fix broken estimators based on percpu stats X-Git-Tag: v4.14.25~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a01550d778a4dd00bfcc548f2bfd57184192cd32;p=platform%2Fkernel%2Flinux-rpi.git net_sched: gen_estimator: fix broken estimators based on percpu stats [ Upstream commit a5f7add332b4ea6d4b9480971b3b0f5e66466ae9 ] pfifo_fast got percpu stats lately, uncovering a bug I introduced last year in linux-4.10. I missed the fact that we have to clear our temporary storage before calling __gnet_stats_copy_basic() in the case of percpu stats. Without this fix, rate estimators (tc qd replace dev xxx root est 1sec 4sec pfifo_fast) are utterly broken. Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators") Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 00ecec4..7f980bd 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c @@ -66,6 +66,7 @@ struct net_rate_estimator { static void est_fetch_counters(struct net_rate_estimator *e, struct gnet_stats_basic_packed *b) { + memset(b, 0, sizeof(*b)); if (e->stats_lock) spin_lock(e->stats_lock);