All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19  6:02 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-19  6:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm-ppc, kvm, Alexander Graf

We were incorrectly g_free'ing an object that isn't allocated
in one error path and failed to release it completely in another

This fixes qemu crashes with some cases of IO errors.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/spapr_vscsi.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
index d2fe3e5..6afc3b4 100644
--- a/hw/spapr_vscsi.c
+++ b/hw/spapr_vscsi.c
@@ -801,6 +801,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
     if (crq->s.IU_length > sizeof(union viosrp_iu)) {
         fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
                 crq->s.IU_length);
+        vscsi_put_req(req);
         return;
     }
 
@@ -808,7 +809,8 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
     if (spapr_vio_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,
                            crq->s.IU_length)) {
         fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
-        g_free(req);
+        vscsi_put_req(req);
+	return;
     }
     memcpy(&req->crq, crq, sizeof(vscsi_crq));
 

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19  6:02 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-19  6:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm, kvm-ppc, Alexander Graf

We were incorrectly g_free'ing an object that isn't allocated
in one error path and failed to release it completely in another

This fixes qemu crashes with some cases of IO errors.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/spapr_vscsi.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
index d2fe3e5..6afc3b4 100644
--- a/hw/spapr_vscsi.c
+++ b/hw/spapr_vscsi.c
@@ -801,6 +801,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
     if (crq->s.IU_length > sizeof(union viosrp_iu)) {
         fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
                 crq->s.IU_length);
+        vscsi_put_req(req);
         return;
     }
 
@@ -808,7 +809,8 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
     if (spapr_vio_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,
                            crq->s.IU_length)) {
         fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
-        g_free(req);
+        vscsi_put_req(req);
+	return;
     }
     memcpy(&req->crq, crq, sizeof(vscsi_crq));
 

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19  6:02 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-19  6:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm-ppc, kvm, Alexander Graf

We were incorrectly g_free'ing an object that isn't allocated
in one error path and failed to release it completely in another

This fixes qemu crashes with some cases of IO errors.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/spapr_vscsi.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
index d2fe3e5..6afc3b4 100644
--- a/hw/spapr_vscsi.c
+++ b/hw/spapr_vscsi.c
@@ -801,6 +801,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
     if (crq->s.IU_length > sizeof(union viosrp_iu)) {
         fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
                 crq->s.IU_length);
+        vscsi_put_req(req);
         return;
     }
 
@@ -808,7 +809,8 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
     if (spapr_vio_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,
                            crq->s.IU_length)) {
         fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
-        g_free(req);
+        vscsi_put_req(req);
+	return;
     }
     memcpy(&req->crq, crq, sizeof(vscsi_crq));
 



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
  2012-06-19  6:02 ` [Qemu-devel] " Benjamin Herrenschmidt
  (?)
@ 2012-06-19 11:31   ` Andreas Färber
  -1 siblings, 0 replies; 18+ messages in thread
From: Andreas Färber @ 2012-06-19 11:31 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: qemu-devel, kvm, kvm-ppc, Alexander Graf

Am 19.06.2012 08:02, schrieb Benjamin Herrenschmidt:
> We were incorrectly g_free'ing an object that isn't allocated
> in one error path and failed to release it completely in another
> 
> This fixes qemu crashes with some cases of IO errors.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  hw/spapr_vscsi.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
> index d2fe3e5..6afc3b4 100644
> --- a/hw/spapr_vscsi.c
> +++ b/hw/spapr_vscsi.c
> @@ -801,6 +801,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
>      if (crq->s.IU_length > sizeof(union viosrp_iu)) {
>          fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
>                  crq->s.IU_length);
> +        vscsi_put_req(req);
>          return;
>      }
>  
> @@ -808,7 +809,8 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
>      if (spapr_vio_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,
>                             crq->s.IU_length)) {
>          fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
> -        g_free(req);
> +        vscsi_put_req(req);

> +	return;

Tab alert. :)

/-F

>      }
>      memcpy(&req->crq, crq, sizeof(vscsi_crq));
>  
> 
> 
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 11:31   ` Andreas Färber
  0 siblings, 0 replies; 18+ messages in thread
From: Andreas Färber @ 2012-06-19 11:31 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: kvm-ppc, qemu-devel, kvm, Alexander Graf

Am 19.06.2012 08:02, schrieb Benjamin Herrenschmidt:
> We were incorrectly g_free'ing an object that isn't allocated
> in one error path and failed to release it completely in another
> 
> This fixes qemu crashes with some cases of IO errors.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  hw/spapr_vscsi.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
> index d2fe3e5..6afc3b4 100644
> --- a/hw/spapr_vscsi.c
> +++ b/hw/spapr_vscsi.c
> @@ -801,6 +801,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
>      if (crq->s.IU_length > sizeof(union viosrp_iu)) {
>          fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
>                  crq->s.IU_length);
> +        vscsi_put_req(req);
>          return;
>      }
>  
> @@ -808,7 +809,8 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
>      if (spapr_vio_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,
>                             crq->s.IU_length)) {
>          fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
> -        g_free(req);
> +        vscsi_put_req(req);

> +	return;

Tab alert. :)

/-F

>      }
>      memcpy(&req->crq, crq, sizeof(vscsi_crq));
>  
> 
> 
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 11:31   ` Andreas Färber
  0 siblings, 0 replies; 18+ messages in thread
From: Andreas Färber @ 2012-06-19 11:31 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: qemu-devel, kvm, kvm-ppc, Alexander Graf

Am 19.06.2012 08:02, schrieb Benjamin Herrenschmidt:
> We were incorrectly g_free'ing an object that isn't allocated
> in one error path and failed to release it completely in another
> 
> This fixes qemu crashes with some cases of IO errors.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  hw/spapr_vscsi.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
> index d2fe3e5..6afc3b4 100644
> --- a/hw/spapr_vscsi.c
> +++ b/hw/spapr_vscsi.c
> @@ -801,6 +801,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
>      if (crq->s.IU_length > sizeof(union viosrp_iu)) {
>          fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
>                  crq->s.IU_length);
> +        vscsi_put_req(req);
>          return;
>      }
>  
> @@ -808,7 +809,8 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
>      if (spapr_vio_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,
>                             crq->s.IU_length)) {
>          fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
> -        g_free(req);
> +        vscsi_put_req(req);

> +	return;

Tab alert. :)

/-F

>      }
>      memcpy(&req->crq, crq, sizeof(vscsi_crq));
>  
> 
> 
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] spapr_vscsi: Error handling fixes
  2012-06-19 11:31   ` Andreas Färber
  (?)
@ 2012-06-19 20:18     ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-19 20:18 UTC (permalink / raw)
  To: Andreas Färber; +Cc: kvm-ppc, qemu-devel, kvm, Alexander Graf

On Tue, 2012-06-19 at 13:31 +0200, Andreas Färber wrote:
> Tab alert. :)

Argh :-) Gotta get an emacs config for use with qemu :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 20:18     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-19 20:18 UTC (permalink / raw)
  To: Andreas Färber; +Cc: kvm-ppc, qemu-devel, kvm, Alexander Graf

On Tue, 2012-06-19 at 13:31 +0200, Andreas Färber wrote:
> Tab alert. :)

Argh :-) Gotta get an emacs config for use with qemu :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 20:18     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-19 20:18 UTC (permalink / raw)
  To: Andreas Färber; +Cc: kvm-ppc, qemu-devel, kvm, Alexander Graf

On Tue, 2012-06-19 at 13:31 +0200, Andreas Färber wrote:
> Tab alert. :)

Argh :-) Gotta get an emacs config for use with qemu :-)

Cheers,
Ben.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
  2012-06-19 20:18     ` Benjamin Herrenschmidt
  (?)
@ 2012-06-19 20:20       ` Alexander Graf
  -1 siblings, 0 replies; 18+ messages in thread
From: Alexander Graf @ 2012-06-19 20:20 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Andreas Färber, qemu-devel, kvm, kvm-ppc


On 19.06.2012, at 22:18, Benjamin Herrenschmidt wrote:

> On Tue, 2012-06-19 at 13:31 +0200, Andreas Färber wrote:
>> Tab alert. :)
> 
> Argh :-) Gotta get an emacs config for use with qemu :-)

So do you want to resend? I can just fix it on the fly too.


Alex

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 20:20       ` Alexander Graf
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Graf @ 2012-06-19 20:20 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: kvm-ppc, Andreas Färber, kvm, qemu-devel


On 19.06.2012, at 22:18, Benjamin Herrenschmidt wrote:

> On Tue, 2012-06-19 at 13:31 +0200, Andreas Färber wrote:
>> Tab alert. :)
> 
> Argh :-) Gotta get an emacs config for use with qemu :-)

So do you want to resend? I can just fix it on the fly too.


Alex

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 20:20       ` Alexander Graf
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Graf @ 2012-06-19 20:20 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Andreas Färber, qemu-devel, kvm, kvm-ppc


On 19.06.2012, at 22:18, Benjamin Herrenschmidt wrote:

> On Tue, 2012-06-19 at 13:31 +0200, Andreas Färber wrote:
>> Tab alert. :)
> 
> Argh :-) Gotta get an emacs config for use with qemu :-)

So do you want to resend? I can just fix it on the fly too.


Alex


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
  2012-06-19 20:20       ` Alexander Graf
  (?)
@ 2012-06-19 20:46         ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-19 20:46 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Andreas Färber, qemu-devel, kvm, kvm-ppc

On Tue, 2012-06-19 at 22:20 +0200, Alexander Graf wrote:
> So do you want to resend? I can just fix it on the fly too.

If you can then sure, please do :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 20:46         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-19 20:46 UTC (permalink / raw)
  To: Alexander Graf; +Cc: kvm-ppc, Andreas Färber, kvm, qemu-devel

On Tue, 2012-06-19 at 22:20 +0200, Alexander Graf wrote:
> So do you want to resend? I can just fix it on the fly too.

If you can then sure, please do :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 20:46         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-19 20:46 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Andreas Färber, qemu-devel, kvm, kvm-ppc

On Tue, 2012-06-19 at 22:20 +0200, Alexander Graf wrote:
> So do you want to resend? I can just fix it on the fly too.

If you can then sure, please do :-)

Cheers,
Ben.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] spapr_vscsi: Error handling fixes
  2012-06-19  6:02 ` [Qemu-devel] " Benjamin Herrenschmidt
  (?)
@ 2012-06-19 20:57   ` Alexander Graf
  -1 siblings, 0 replies; 18+ messages in thread
From: Alexander Graf @ 2012-06-19 20:57 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: qemu-devel, kvm-ppc, kvm


On 19.06.2012, at 08:02, Benjamin Herrenschmidt wrote:

> We were incorrectly g_free'ing an object that isn't allocated
> in one error path and failed to release it completely in another
> 
> This fixes qemu crashes with some cases of IO errors.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Thanks, applied to ppc-next.


Alex

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 20:57   ` Alexander Graf
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Graf @ 2012-06-19 20:57 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: qemu-devel, kvm-ppc, kvm


On 19.06.2012, at 08:02, Benjamin Herrenschmidt wrote:

> We were incorrectly g_free'ing an object that isn't allocated
> in one error path and failed to release it completely in another
> 
> This fixes qemu crashes with some cases of IO errors.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Thanks, applied to ppc-next.


Alex

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] spapr_vscsi: Error handling fixes
@ 2012-06-19 20:57   ` Alexander Graf
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Graf @ 2012-06-19 20:57 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: qemu-devel, kvm-ppc, kvm


On 19.06.2012, at 08:02, Benjamin Herrenschmidt wrote:

> We were incorrectly g_free'ing an object that isn't allocated
> in one error path and failed to release it completely in another
> 
> This fixes qemu crashes with some cases of IO errors.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Thanks, applied to ppc-next.


Alex


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-06-19 20:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19  6:02 [PATCH] spapr_vscsi: Error handling fixes Benjamin Herrenschmidt
2012-06-19  6:02 ` Benjamin Herrenschmidt
2012-06-19  6:02 ` [Qemu-devel] " Benjamin Herrenschmidt
2012-06-19 11:31 ` Andreas Färber
2012-06-19 11:31   ` Andreas Färber
2012-06-19 11:31   ` Andreas Färber
2012-06-19 20:18   ` Benjamin Herrenschmidt
2012-06-19 20:18     ` [Qemu-devel] " Benjamin Herrenschmidt
2012-06-19 20:18     ` Benjamin Herrenschmidt
2012-06-19 20:20     ` Alexander Graf
2012-06-19 20:20       ` Alexander Graf
2012-06-19 20:20       ` Alexander Graf
2012-06-19 20:46       ` Benjamin Herrenschmidt
2012-06-19 20:46         ` Benjamin Herrenschmidt
2012-06-19 20:46         ` Benjamin Herrenschmidt
2012-06-19 20:57 ` Alexander Graf
2012-06-19 20:57   ` Alexander Graf
2012-06-19 20:57   ` [Qemu-devel] " Alexander Graf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.