From patchwork Thu Nov 21 14:34:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 3218941 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8D2C2C045B for ; Thu, 21 Nov 2013 14:35:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD3ED20789 for ; Thu, 21 Nov 2013 14:35:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C95982077F for ; Thu, 21 Nov 2013 14:35:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754181Ab3KUOfY (ORCPT ); Thu, 21 Nov 2013 09:35:24 -0500 Received: from packetmixer.de ([79.140.42.25]:55847 "EHLO mail.mail.packetmixer.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754160Ab3KUOfX (ORCPT ); Thu, 21 Nov 2013 09:35:23 -0500 Received: from kero.packetmixer.de (drsd-4dbdbb45.pool.mediaWays.net [77.189.187.69]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mail.packetmixer.de (Postfix) with ESMTPSA id BDD5362404; Thu, 21 Nov 2013 14:47:21 +0000 (UTC) From: Simon Wunderlich To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Simon Wunderlich Subject: [RFC 3/3] mac80211: don't cancel csa finalize work within stop_ap Date: Thu, 21 Nov 2013 15:34:22 +0100 Message-Id: <1385044462-23046-4-git-send-email-sw@simonwunderlich.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1385044462-23046-1-git-send-email-sw@simonwunderlich.de> References: <1385044462-23046-1-git-send-email-sw@simonwunderlich.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current channel switch code has a potential deadlock: 1) * cfg80211_stop_ap acquires wdev-lock * ieee80211_stop_ap calls cancel_work_sync for the csa_finalize_work, which acquires the associated worker-lock 2) * ieee80211_csa_finalize_work holds the worker-lock when run * it calls cfg80211_ch_switch_notify which will claim the wdev-lock, and also needs to claim the sdata-lock (which is the same as the wdev-lock) to modify the beacons. It is sufficient to just set the channel switch active to false. If the worker is running later, it will find the channel switch to not be active anymore and returns immediately without changing anything. Canceling the worker is done anyway when the interface goes down (ieee80211_do_stop). Reported-by: Johannes Berg Signed-off-by: Simon Wunderlich --- net/mac80211/cfg.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a715c9b..7315819 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1095,7 +1095,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) /* abort any running channel switch */ sdata->vif.csa_active = false; - cancel_work_sync(&sdata->csa_finalize_work); cancel_work_sync(&sdata->u.ap.request_smps_work); /* turn off carrier for this interface and dependent VLANs */