From patchwork Wed May 31 02:56:56 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: 9755705 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 79485602CA for ; Wed, 31 May 2017 02:55:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69D212094F for ; Wed, 31 May 2017 02:55:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B24F20952; Wed, 31 May 2017 02:55:33 +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=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 034302074F for ; Wed, 31 May 2017 02:55:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751057AbdEaCzU (ORCPT ); Tue, 30 May 2017 22:55:20 -0400 Received: from m12-17.163.com ([220.181.12.17]:43085 "EHLO m12-17.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751030AbdEaCzT (ORCPT ); Tue, 30 May 2017 22:55:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=dkQqaCXzpjTe1MW1om dsCzovHJaUdr2VFBpGjN3JLh0=; b=i3tUhL++NGcd7+euzmK3etUyU+BjYJaBax zADTY/9SexAK3tWVgr8c+BMpzqc/LyTLVnQ439o8pw7vCSgvuIpMdZbbzzzuzRyK wfahqLrvuVNxViSYG837WwJqeeKZaxu+E/DPftAN1BRWqQ1l4CXgFG7/eskTVgq+ euGVFILSQ= Received: from bai-oslab.tsinghua.edu.cn (unknown [166.111.70.19]) by smtp13 (Coremail) with SMTP id EcCowADX5w90MC5ZUACIHQ--.59049S2; Wed, 31 May 2017 10:54:49 +0800 (CST) From: Jia-Ju Bai To: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] megaraid: Fix a sleep-in-atomic bug Date: Wed, 31 May 2017 10:56:56 +0800 Message-Id: <1496199416-2556-1-git-send-email-baijiaju1990@163.com> X-Mailer: git-send-email 1.7.9.5 X-CM-TRANSID: EcCowADX5w90MC5ZUACIHQ--.59049S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7XryfCw18tFy5ury5CF47twb_yoWfCFgE9r 4UXrn2kryaqFsakr1fA3y5urnFkw1ru3Z2kFnIqw1fAFZ8Xr9rK34kZr13uws8G3ySka43 Ar15Wr4FywnrujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRRuyI5UUUUU== X-Originating-IP: [166.111.70.19] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/1tbiThPoelUCyH9-XwABsO Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver may sleep under a spin lock, and the function call path is: mraid_mm_attach_buf (acquire the lock by spin_lock_irqsave) pci_pool_alloc(GFP_KERNEL) --> may sleep To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC". Signed-off-by: Jia-Ju Bai Acked-by: Sumit Saxena --- drivers/scsi/megaraid/megaraid_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index 4cf9ed9..c43afb8 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c @@ -574,7 +574,7 @@ kioc->pool_index = right_pool; kioc->free_buf = 1; - kioc->buf_vaddr = pci_pool_alloc(pool->handle, GFP_KERNEL, + kioc->buf_vaddr = pci_pool_alloc(pool->handle, GFP_ATOMIC, &kioc->buf_paddr); spin_unlock_irqrestore(&pool->lock, flags);