xen-scsifront: don't deadlock if the ring becomes full
Subsystems (3)
PATCH 1/1 xen-scsifront: don't deadlock if the ring becomes full
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 <[email protected]>
---
This was found with sparse. I've not tested it.
--- drivers/scsi/xen-scsifront.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/xen-scsifront.c +2 -1
@@ -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)
Signature · 1 line
1.7.10.4
Quoted 6 lines · David Vrabel
scsifront_action_handler()will deadlock onhost->host_lock, if the ring is full and it has to wait for entries to become available.Signed-off-by David Vrabel <[email protected]>---
This was found with sparse. I've not tested it.
Test might be difficult. :-)
Reviewed-by Juergen Gross <[email protected]>
Thanks for spotting this.
Juergen
Quoted 20 lines
--- drivers/scsi/xen-scsifront.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/scsi/xen-scsifront.c +2
-1@@ -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)
Quoted 6 lines · David Vrabel
scsifront_action_handler()will deadlock onhost->host_lock, if the ring is full and it has to wait for entries to become available.Signed-off-by David Vrabel <[email protected]>---
This was found with sparse. I've not tested it.
Test might be difficult. :-)
Reviewed-by Juergen Gross <[email protected]>
Thanks for spotting this.
Juergen
Quoted 20 lines
--- drivers/scsi/xen-scsifront.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/scsi/xen-scsifront.c +2
-1@@ -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)