Skip to contentSkip to conversation

esp: cancel current request only if some request is in flight

PATCH Applied Hervé Poussineau 2 participants 2 messages Jul 9, 2011 – Jul 12, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 esp: cancel current request only if some request is in flight

This bug was introduced in 94d3f98a3f3caddd7875f9a11776daeb84962a7b:
scsi_cancel_io was checking if some request was pending before trying to cancel it, while scsi_req_cancel always cancels the request.

This may lead to a crash of Qemu due to dereferencing a NULL pointer, as exhibited by NetBSD 5.1 installer on MIPS Magnum emulation.

---

Changes since v1:
- better commit message

 hw/esp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/esp.c +1 -1
index 8e95672..aa50800 100644
@@ -219,7 +219,7 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf)
     s->ti_rptr = 0;
     s->ti_wptr = 0;
 
-    if (s->current_dev) {
+    if (s->current_req) {
         /* Started a new command before the old one finished.  Cancel it.  */
         scsi_req_cancel(s->current_req);
         s->async_len = 0;
Signature · 1 line
1.7.5.4
Applied
#1 lore raw

Thanks, applied.

2011/7/9 Hervé Poussineau <[email protected]>:

Quoted 33 lines

This bug was introduced in 94d3f98a3f3caddd7875f9a11776daeb84962a7b:
scsi_cancel_io was checking if some request was pending before trying to cancel it, while scsi_req_cancel always cancels the request.

This may lead to a crash of Qemu due to dereferencing a NULL pointer, as exhibited by NetBSD 5.1 installer on MIPS Magnum emulation.

---

Changes since v1:
- better commit message

 hw/esp.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
hw/esp.c +1 -2
index 8e95672..aa50800 100644
@@ -219,7 +219,7 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf)
     s->ti_rptr = 0;
     s->ti_wptr = 0;
 
-    if (s->current_dev) {
+    if (s->current_req) {
         /* Started a new command before the old one finished.  Cancel it.  */
         scsi_req_cancel(s->current_req);
         s->async_len = 0;
--

1.7.5.4