Re: [PATCH] xen-scsifront: don't deadlock if the ring becomes full

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/11/2014 03:31 PM, David Vrabel wrote:
scsifront_action_handler() will deadlock on host->host_lock, if the
ring is full and it has to wait for entries to become available.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
---
This was found with sparse. I've not tested it.

Test might be difficult. :-)

Reviewed-by: Juergen Gross <jgross@xxxxxxxx>

Thanks for spotting this.

Juergen

---
  drivers/scsi/xen-scsifront.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 7e88659..cc14c8d 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -541,8 +541,9 @@ static int scsifront_action_handler(struct scsi_cmnd *sc, uint8_t act)
  	if (!shadow)
  		return FAILED;

+	spin_lock_irq(host->host_lock);
+
  	for (;;) {
-		spin_lock_irq(host->host_lock);
  		if (!RING_FULL(&info->ring)) {
  			ring_req = scsifront_command2ring(info, sc, shadow);
  			if (ring_req)


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux