Received: by 10.223.185.116 with SMTP id b49csp1057209wrg; Fri, 23 Feb 2018 11:07:33 -0800 (PST) X-Google-Smtp-Source: AH8x225A0lA3oNJ9q7LuJdgkfdhyKRGgA+XiK4qCgURa2ennyxV0JKHeMvYqo4+ZPsXG1fMf60ZF X-Received: by 2002:a17:902:788e:: with SMTP id q14-v6mr2619883pll.396.1519412852933; Fri, 23 Feb 2018 11:07:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519412852; cv=none; d=google.com; s=arc-20160816; b=EK7fVjhAoZTgKyMyR3zG534WzOkMDsclLI7LqDteg/hpr2osbYqJ9HZasu2wBCtwN5 9og29GurNWVtu5vRRXcUyh0hUv44xbKt6DOCdqd4k+JcWo5hEV0cCFHuNBT7eZDPAaz0 IAWRBnDzu4zahH+wyMdSS+PkyuzwzDqbC4bu6k6WposoOQuBG++LVqkL1ku6Mo2gCZWQ nApUb/9apcKc189xbeQRRLCu0gMyC2z735FVf1gnHZGbJyu305w7/15Yxe0dPFkvc1vb EkL0NdBmB9HIGoUhHNREHIjpOmdMMeqh23RA6wbxZX3Aim2ySc1MRyyI/oPBQDc+C0Ld c7rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=gpfUk9fMmYZAYB3MDFJPk4eMYe3tlI8dVpHLfGbtHH0=; b=uqmRCT1L7V3u196eDZMsH2LeT2q/RYJTx1QQSRWJfoV3FLtg1h2gw2Y9zqjNcVI9JJ n2BdiBGXn9u8HoWVwIFgIAn1SXONV6ba2u1XsbtIWHUjgJGiNnWnvzwZ9+5NK46sCCRe 1UODcMz8R7bfJFdTWHKqzkh0FZyYpBYds34qE+s4M1mDXWPEt47tuiW6OJuC17lAHTuR v3+6AqucJQUXic8eN59c7I5edQHUyFmxApjIoqgz2iSvJWd3U3n9/ziBBOuf4l3FO4FE qXY/XOXiIh1EeQ5uHARBVLaGKshzK8zFDbe1raPJ6CkgRXynQzTUsD+16UhFeeDEXWCg f4Nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u14si2238865pfa.271.2018.02.23.11.07.18; Fri, 23 Feb 2018 11:07:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754476AbeBWTF7 (ORCPT + 99 others); Fri, 23 Feb 2018 14:05:59 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50308 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965460AbeBWS5q (ORCPT ); Fri, 23 Feb 2018 13:57:46 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AB18D107C; Fri, 23 Feb 2018 18:57:45 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , Cong Wang , "David S. Miller" Subject: [PATCH 4.15 22/45] net_sched: gen_estimator: fix lockdep splat Date: Fri, 23 Feb 2018 19:29:01 +0100 Message-Id: <20180223170718.773911623@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170715.197760019@linuxfoundation.org> References: <20180223170715.197760019@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit 40ca54e3a686f13117f3de0c443f8026dadf7c44 upstream. 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/gen_estimator.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c @@ -159,7 +159,11 @@ int gen_new_estimator(struct gnet_stats_ est->intvl_log = intvl_log; est->cpu_bstats = cpu_bstats; + if (stats_lock) + local_bh_disable(); est_fetch_counters(est, &b); + if (stats_lock) + local_bh_enable(); est->last_bytes = b.bytes; est->last_packets = b.packets; old = rcu_dereference_protected(*rate_est, 1);