From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cong Wang Subject: Re: [PATCH net] net_sched: gen_estimator: fix lockdep splat Date: Sun, 28 Jan 2018 19:44:36 -0800 Message-ID: References: <1517079523.3715.73.camel@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: David Miller , netdev , Jamal Hadi Salim , Jiri Pirko To: Eric Dumazet Return-path: Received: from mail-pf0-f179.google.com ([209.85.192.179]:40177 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbeA2Do5 (ORCPT ); Sun, 28 Jan 2018 22:44:57 -0500 Received: by mail-pf0-f179.google.com with SMTP id i66so3768076pfd.7 for ; Sun, 28 Jan 2018 19:44:57 -0800 (PST) In-Reply-To: <1517079523.3715.73.camel@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On Sat, Jan 27, 2018 at 10:58 AM, Eric Dumazet wrote: > From: Eric Dumazet > > syzbot reported a lockdep splat in gen_new_estimator() / > est_fetch_counters() when attempting to lock est->stats_lock. > > Since est_fetch_counters() is called from BH context from timer > interrupt, we need to block BH as well when calling it from process > context. > > Most qdiscs use per cpu counters and are immune to the problem, > but net/sched/act_api.c and net/netfilter/xt_RATEEST.c are using > a spinlock to protect their data. They both call gen_new_estimator() > while object is created and not yet alive, so this bug could > not trigger a deadlock, only a lockdep splat. > > Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators") > Signed-off-by: Eric Dumazet > Reported-by: syzbot Acked-by: Cong Wang Nit: perhaps it is better to move the spin_lock out of est_fetch_counters() and let callers decide to use spin_lock or spin_lock_bh.