From patchwork Wed May 31 10:09:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 9756553 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6B53C60360 for ; Wed, 31 May 2017 10:07:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68EB0206AC for ; Wed, 31 May 2017 10:07:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D810283BA; Wed, 31 May 2017 10:07:57 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 0C9F0206AC for ; Wed, 31 May 2017 10:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751042AbdEaKHk (ORCPT ); Wed, 31 May 2017 06:07:40 -0400 Received: from m12-16.163.com ([220.181.12.16]:39457 "EHLO m12-16.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750869AbdEaKHj (ORCPT ); Wed, 31 May 2017 06:07:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=rjkPxEuW1r0TEbZjVL leQ8FDcKbI97kPrtIUZ/P5NIw=; b=UW/DRuUbvTPkxjhHB72IXNsQaIR4LU1ezM vsEyefIcC22vzUGTXwoV1llmj5Frajov+TGyDG+gl7XvsbILvSI8HFKi8oRLHRjW 2Q5nNAMl2pV5RdfOiQg/fM0YyZRUrd2lyOGbm7GT8IaJS95IzZaSfecjl6gRdHtd JVPs7d158= Received: from bai-oslab.tsinghua.edu.cn (unknown [166.111.70.19]) by smtp12 (Coremail) with SMTP id EMCowAB3MzDElS5ZY7ZIHQ--.28606S2; Wed, 31 May 2017 18:07:03 +0800 (CST) From: Jia-Ju Bai To: Larry.Finger@lwfinger.net, kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] b43legacy: Fix a sleep-in-atomic bug in b43legacy_op_bss_info_changed Date: Wed, 31 May 2017 18:09:13 +0800 Message-Id: <1496225353-5544-1-git-send-email-baijiaju1990@163.com> X-Mailer: git-send-email 1.7.9.5 X-CM-TRANSID: EMCowAB3MzDElS5ZY7ZIHQ--.28606S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7XryfCw18tFy5ZFW3XF45GFg_yoWkurX_Kw n8XF18Jw1rGw1S9w18CF43ArWjy34DWw1rG393KFW3G3yYq3yftFWvyF13Wr98ua13GF43 Ar4UZa18C34IgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU1D73PUUUUU== X-Originating-IP: [166.111.70.19] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/1tbiTQfoelc69XVEHAAAst 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 The driver may sleep under a spin lock, and the function call path is: b43legacy_op_bss_info_changed (acquire the lock by spin_lock_irqsave) b43legacy_synchronize_irq synchronize_irq --> may sleep To fix it, the lock is released before b43legacy_synchronize_irq, and the lock is acquired again after this function. Signed-off-by: Jia-Ju Bai --- drivers/net/wireless/broadcom/b43legacy/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c index f1e3dad..31ead21 100644 --- a/drivers/net/wireless/broadcom/b43legacy/main.c +++ b/drivers/net/wireless/broadcom/b43legacy/main.c @@ -2859,7 +2859,9 @@ static void b43legacy_op_bss_info_changed(struct ieee80211_hw *hw, b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, 0); if (changed & BSS_CHANGED_BSSID) { + spin_unlock_irqrestore(&wl->irq_lock, flags); b43legacy_synchronize_irq(dev); + spin_lock_irqsave(&wl->irq_lock, flags); if (conf->bssid) memcpy(wl->bssid, conf->bssid, ETH_ALEN);