From: Jia-Ju Bai <baijiaju1990@163.com>
To: Sumit Saxena <sumit.saxena@broadcom.com>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>,
Shivasharan Srikanteshwara
<shivasharan.srikanteshwara@broadcom.com>,
jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
"PDL,MEGARAIDLINUX" <megaraidlinux.pdl@broadcom.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] megaraid: Fix a sleep-in-atomic bug
Date: Thu, 01 Jun 2017 11:38:51 +0800 [thread overview]
Message-ID: <592F8C4B.3080109@163.com> (raw)
In-Reply-To: <ecd2b8137043d6c6b75c4f44b963bebd@mail.gmail.com>
On 05/31/2017 06:18 PM, Sumit Saxena wrote:
>> -----Original Message-----
>> From: Jia-Ju Bai [mailto:baijiaju1990@163.com]
>> Sent: Wednesday, May 31, 2017 8:27 AM
>> 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
>>
>> 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<baijiaju1990@163.com>
>> ---
>> 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);
> This is very old driver and reached EOL. Did you face any issue because of
> this bug or discover this through code review?
> Anyways patch looks good to me.
>
> Acked-by: Sumit Saxena<sumit.saxena@broadcom.com>
>
>> --
>> 1.7.9.5
>>
Hi,
This bug is found by a static analysis tool and my code review.
Jia-Ju Bai
prev parent reply other threads:[~2017-06-01 3:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 2:56 [PATCH] megaraid: Fix a sleep-in-atomic bug Jia-Ju Bai
2017-05-31 10:18 ` Sumit Saxena
2017-06-01 3:38 ` Jia-Ju Bai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=592F8C4B.3080109@163.com \
--to=baijiaju1990@163.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=kashyap.desai@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=megaraidlinux.pdl@broadcom.com \
--cc=shivasharan.srikanteshwara@broadcom.com \
--cc=sumit.saxena@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox