From patchwork Wed May 31 10:29:07 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: 9756585 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 4A48F603F7 for ; Wed, 31 May 2017 10:27:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48C352766D for ; Wed, 31 May 2017 10:27:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D59B283D1; Wed, 31 May 2017 10:27:44 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 E8B2327CEA for ; Wed, 31 May 2017 10:27:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751274AbdEaK1a (ORCPT ); Wed, 31 May 2017 06:27:30 -0400 Received: from m12-11.163.com ([220.181.12.11]:43788 "EHLO m12-11.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751029AbdEaK13 (ORCPT ); Wed, 31 May 2017 06:27:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=WzUX40MI+parHSpTZi DpQNvt7N16UefNBRC06MRTjp8=; b=IVukMNysPyqljx89pRc91XiTvSkLld/l6s jYLRKjh0P+kX+KCttZtRvb5K9OENwHGaIaEG294V7YXrDJq4P+0XWC4FNZW4g/mN XIToZCTUIWX7aQowkT6BeXA6jVRJui/JbtodAa+nBCzYiblwHWSJHFsE7Nw4ZJ2M h2xbSr7U4= Received: from bai-oslab.tsinghua.edu.cn (unknown [166.111.70.19]) by smtp7 (Coremail) with SMTP id C8CowAAHzChtmi5ZjbtQHw--.42151S2; Wed, 31 May 2017 18:26:56 +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_attr_interfmode_store Date: Wed, 31 May 2017 18:29:07 +0800 Message-Id: <1496226547-5921-1-git-send-email-baijiaju1990@163.com> X-Mailer: git-send-email 1.7.9.5 X-CM-TRANSID: C8CowAAHzChtmi5ZjbtQHw--.42151S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7ZFy8Zw4UtF17ury7CFW5GFg_yoW8XF43pr 4DGFy5K3WDXr48Xw4UCF1xZF1DZwn5G3y7CrWru3yxCFs8X34F9w1SqFy7AFWFyrZ7GF4x ZF1UXFZ7Za4kG3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07Ut8nOUUUUU= X-Originating-IP: [166.111.70.19] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/1tbiTh-oelUCyIZSbwABsm 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_attr_interfmode_store (acquire the lock by spin_lock_irqsave) b43legacy_radio_set_interference_mitigation b43legacy_radio_interference_mitigation_disable b43legacy_calc_nrssi_slope b43legacy_synth_pu_workaround might_sleep and msleep --> may sleep Fixing it may be complex, and a possible way is to remove spin_lock_irqsave and spin_lock_irqrestore in b43legacy_attr_interfmode_store, and the code has been protected by mutex_lock and mutex_unlock. Signed-off-by: Jia-Ju Bai --- drivers/net/wireless/broadcom/b43legacy/sysfs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43legacy/sysfs.c b/drivers/net/wireless/broadcom/b43legacy/sysfs.c index 2a1da15..9ede143 100644 --- a/drivers/net/wireless/broadcom/b43legacy/sysfs.c +++ b/drivers/net/wireless/broadcom/b43legacy/sysfs.c @@ -137,14 +137,12 @@ static ssize_t b43legacy_attr_interfmode_store(struct device *dev, } mutex_lock(&wldev->wl->mutex); - spin_lock_irqsave(&wldev->wl->irq_lock, flags); err = b43legacy_radio_set_interference_mitigation(wldev, mode); if (err) b43legacyerr(wldev->wl, "Interference Mitigation not " "supported by device\n"); mmiowb(); - spin_unlock_irqrestore(&wldev->wl->irq_lock, flags); mutex_unlock(&wldev->wl->mutex); return err ? err : count;