From patchwork Tue Feb 5 19:53:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 10798301 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A10751805 for ; Tue, 5 Feb 2019 19:53:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91DA029078 for ; Tue, 5 Feb 2019 19:53:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85E942C61B; Tue, 5 Feb 2019 19:53:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 149242C5EA for ; Tue, 5 Feb 2019 19:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729373AbfBETxp (ORCPT ); Tue, 5 Feb 2019 14:53:45 -0500 Received: from s3.sipsolutions.net ([144.76.43.62]:40734 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728644AbfBETxo (ORCPT ); Tue, 5 Feb 2019 14:53:44 -0500 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92-RC4) (envelope-from ) id 1gr6ms-0006Ga-0R; Tue, 05 Feb 2019 20:53:42 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg Subject: [PATCH] mac80211: mesh: do mesh rhashtable walks with BHs disabled Date: Tue, 5 Feb 2019 20:53:39 +0100 Message-Id: <20190205195339.7585-1-johannes@sipsolutions.net> X-Mailer: git-send-email 2.17.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Berg Since we do some walks from *within* softirq context and the rhashtable code just uses a plain spin_lock(), we need to disable softirqs for other walks that are not within softirq context to avoid a potential deadlock (taking a softirq that takes the spinlock while inside the spinlock from regular process context.) Reported-by: Jouni Malinen Signed-off-by: Johannes Berg --- net/mac80211/mesh_pathtbl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index a5125624a76d..f1912afd03dd 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c @@ -880,8 +880,11 @@ void mesh_path_tbl_expire(struct ieee80211_sub_if_data *sdata, void mesh_path_expire(struct ieee80211_sub_if_data *sdata) { + /* we do other walks inside softirq, so need to disable them here */ + local_bh_disable(); mesh_path_tbl_expire(sdata, sdata->u.mesh.mesh_paths); mesh_path_tbl_expire(sdata, sdata->u.mesh.mpp_paths); + local_bh_enable(); } void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata)