public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <jejb@linux.vnet.ibm.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>,
	qla2xxx-upstream@qlogic.com, martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] scsi/qla2xxx: a possible sleep-in-atomic bug in qlt_get_tag
Date: Tue, 12 Dec 2017 20:42:01 -0800	[thread overview]
Message-ID: <1513140121.3110.78.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <0363371c-db1c-169f-df5f-ca15b3839e41@gmail.com>

On Wed, 2017-12-13 at 11:18 +0800, Jia-Ju Bai wrote:
> The driver may sleep under a spinlock.
> The function call paths are:
> qlt_handle_abts_recv_work (acquire the spinlock)
>    qlt_response_pkt_all_vps
>      qlt_response_pkt
>        qlt_handle_cmd_for_atio
>          qlt_get_tag
>            percpu_ida_alloc --> may sleep
> 
> qla82xx_msix_rsp_q (acquire the spinlock)
>    qla24xx_process_response_queue
>      qlt_handle_abts_recv
>        qlt_response_pkt_all_vps
>          qlt_response_pkt
>            qlt_handle_cmd_for_atio
>              qlt_get_tag
>                percpu_ida_alloc --> may sleep-in-atomic
> 
> qla24xx_intr_handler (acquire the spinlock)
>    qla24xx_process_response_queue
>      qlt_handle_abts_recv
>        qlt_response_pkt
>          qlt_handle_cmd_for_atio
>            qlt_get_tag
>              percpu_ida_alloc --> may sleep
> 
> I do not find a good way to fix it, so I only report.
> This possible bug is found by my static analysis tool (DSAC) and
> checked by my code review.

The report is incorrect: percpu_ida_alloc with state==TASK_RUNNING is
atomic (and interrupt) safe which appears to be the case here.

James

  reply	other threads:[~2017-12-13  4:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13  3:18 [BUG] scsi/qla2xxx: a possible sleep-in-atomic bug in qlt_get_tag Jia-Ju Bai
2017-12-13  4:42 ` James Bottomley [this message]
2017-12-13  7:38   ` Jia-Ju Bai

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=1513140121.3110.78.camel@linux.vnet.ibm.com \
    --to=jejb@linux.vnet.ibm.com \
    --cc=baijiaju1990@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=qla2xxx-upstream@qlogic.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