Patchwork lsi: fix segfault in lsi_command_complete

login
register
mail settings
Submitter Gerd Hoffmann
Date March 29, 2010, 1:42 p.m.
Message ID <1269870177-31797-1-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/48845/
State New
Headers show

Comments

Gerd Hoffmann - March 29, 2010, 1:42 p.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/lsi53c895a.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Aurelien Jarno - April 9, 2010, 7:51 p.m.
On Mon, Mar 29, 2010 at 03:42:57PM +0200, Gerd Hoffmann wrote:
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Thanks, applied.

> ---
>  hw/lsi53c895a.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
> index a332401..525f3ca 100644
> --- a/hw/lsi53c895a.c
> +++ b/hw/lsi53c895a.c
> @@ -679,7 +679,7 @@ static void lsi_command_complete(SCSIBus *bus, int reason, uint32_t tag,
>          return;
>      }
>  
> -    if (s->waiting == 1 || tag != s->current->tag ||
> +    if (s->waiting == 1 || !s->current || tag != s->current->tag ||
>          (lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON))) {
>          if (lsi_queue_tag(s, tag, arg))
>              return;
> -- 
> 1.6.6.1
> 
> 
> 
>

Patch

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index a332401..525f3ca 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -679,7 +679,7 @@  static void lsi_command_complete(SCSIBus *bus, int reason, uint32_t tag,
         return;
     }
 
-    if (s->waiting == 1 || tag != s->current->tag ||
+    if (s->waiting == 1 || !s->current || tag != s->current->tag ||
         (lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON))) {
         if (lsi_queue_tag(s, tag, arg))
             return;