From: "Rangankar, Manish" <Manish.Rangankar@cavium.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>,
Dept-Eng QLogic Storage Upstream
<QLogic-Storage-Upstream@cavium.com>,
"jejb@linux.vnet.ibm.com" <jejb@linux.vnet.ibm.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] qedi: Fix a possible sleep-in-atomic bug in qedi_process_tmf_resp
Date: Wed, 13 Dec 2017 09:12:11 +0000 [thread overview]
Message-ID: <D656EC82.4ACF8%manish.rangankar@cavium.com> (raw)
In-Reply-To: <1513156268-13328-1-git-send-email-baijiaju1990@gmail.com>
On 13/12/17 2:41 PM, "Jia-Ju Bai" <baijiaju1990@gmail.com> wrote:
>The driver may sleep under a spinlock.
>The function call path is:
>qedi_cpu_offline (acquire the spinlock)
> qedi_fp_process_cqes
> qedi_mtask_completion
> qedi_process_tmf_resp
> kzalloc(GFP_KERNEL) --> may sleep
>
>To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.
>
>This bug is found by my static analysis tool(DSAC) and checked by my code
>review.
>
>Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
>---
> drivers/scsi/qedi/qedi_fw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
>index bd302d3..20a9259 100644
>--- a/drivers/scsi/qedi/qedi_fw.c
>+++ b/drivers/scsi/qedi/qedi_fw.c
>@@ -198,7 +198,7 @@ static void qedi_process_tmf_resp(struct qedi_ctx
>*qedi,
> cqe_tmp_response = &cqe->cqe_common.iscsi_hdr.tmf_response;
>
> qedi_cmd = task->dd_data;
>- qedi_cmd->tmf_resp_buf = kzalloc(sizeof(*resp_hdr_ptr), GFP_KERNEL);
>+ qedi_cmd->tmf_resp_buf = kzalloc(sizeof(*resp_hdr_ptr), GFP_ATOMIC);
> if (!qedi_cmd->tmf_resp_buf) {
> QEDI_ERR(&qedi->dbg_ctx,
> "Failed to allocate resp buf, cid=0x%x\n",
>--
>1.7.9.5
Thanks,
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
>
next prev parent reply other threads:[~2017-12-13 9:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 9:11 Jia-Ju Bai
2017-12-13 9:12 ` Rangankar, Manish [this message]
2017-12-19 3:33 ` Martin K. Petersen
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=D656EC82.4ACF8%manish.rangankar@cavium.com \
--to=manish.rangankar@cavium.com \
--cc=QLogic-Storage-Upstream@cavium.com \
--cc=baijiaju1990@gmail.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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
Powered by JetHome