xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen-scsifront: Add a missing call to kfree
@ 2016-11-19 18:22 Quentin Lambert
  0 siblings, 0 replies; 9+ messages in thread
From: Quentin Lambert @ 2016-11-19 18:22 UTC (permalink / raw)
  To: Juergen Gross, Boris Ostrovsky, David Vrabel,
	James E.J. Bottomley, Martin K. Petersen, xen-devel, linux-scsi,
	linux-kernel, kernel-janitors
  Cc: Quentin Lambert

Most error branches following the call to kmalloc contain
a call to kfree. This patch add these calls where they are
missing.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

---
 drivers/scsi/xen-scsifront.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -627,6 +627,7 @@ static int scsifront_action_handler(stru
 
 	if (scsifront_enter(info)) {
 		spin_unlock_irq(host->host_lock);
+		kfree(shadow);
 		return FAILED;
 	}
 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] xen-scsifront: Add a missing call to kfree
       [not found] <20161119182256.9081-1-lambert.quentin@gmail.com>
@ 2016-11-21  6:01 ` Juergen Gross
       [not found] ` <1320a162-dc36-5833-a746-367134dae5e7@suse.com>
  2016-11-24  8:24 ` Juergen Gross
  2 siblings, 0 replies; 9+ messages in thread
From: Juergen Gross @ 2016-11-21  6:01 UTC (permalink / raw)
  To: Quentin Lambert, Boris Ostrovsky, David Vrabel,
	James E.J. Bottomley, Martin K. Petersen, xen-devel, linux-scsi,
	linux-kernel, kernel-janitors

On 19/11/16 19:22, Quentin Lambert wrote:
> Most error branches following the call to kmalloc contain
> a call to kfree. This patch add these calls where they are
> missing.
> 
> This issue was found with Hector.
> 
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

Nice catch. I think this will need some more work, I'll do a
follow-on patch.

Reviewed-by: Juergen Gross <jgross@suse.com>

> 
> ---
>  drivers/scsi/xen-scsifront.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- a/drivers/scsi/xen-scsifront.c
> +++ b/drivers/scsi/xen-scsifront.c
> @@ -627,6 +627,7 @@ static int scsifront_action_handler(stru
>  
>  	if (scsifront_enter(info)) {
>  		spin_unlock_irq(host->host_lock);
> +		kfree(shadow);
>  		return FAILED;
>  	}
>  
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] xen-scsifront: Add a missing call to kfree
       [not found] ` <1320a162-dc36-5833-a746-367134dae5e7@suse.com>
@ 2016-11-22  3:40   ` Martin K. Petersen
       [not found]   ` <yq1twb0yygf.fsf@sermon.lab.mkp.net>
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2016-11-22  3:40 UTC (permalink / raw)
  To: Juergen Gross
  Cc: James E.J. Bottomley, linux-scsi, Martin K. Petersen,
	Quentin Lambert, kernel-janitors, linux-kernel, David Vrabel,
	xen-devel, Boris Ostrovsky

>>>>> "Juergen" == Juergen Gross <jgross@suse.com> writes:

Juergen,

Juergen> On 19/11/16 19:22, Quentin Lambert wrote:
>> Most error branches following the call to kmalloc contain a call to
>> kfree. This patch add these calls where they are missing.
>> 
>> This issue was found with Hector.
>> 
>> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

Juergen> Nice catch. I think this will need some more work, I'll do a
Juergen> follow-on patch.

Juergen> Reviewed-by: Juergen Gross <jgross@suse.com>

Are you taking this patch through the Xen tree or should I queue it up?

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] xen-scsifront: Add a missing call to kfree
       [not found]   ` <yq1twb0yygf.fsf@sermon.lab.mkp.net>
@ 2016-11-22  5:19     ` Juergen Gross
  0 siblings, 0 replies; 9+ messages in thread
From: Juergen Gross @ 2016-11-22  5:19 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: James E.J. Bottomley, linux-scsi, Quentin Lambert,
	kernel-janitors, linux-kernel, David Vrabel, xen-devel,
	Boris Ostrovsky

On 22/11/16 04:40, Martin K. Petersen wrote:
>>>>>> "Juergen" == Juergen Gross <jgross@suse.com> writes:
> 
> Juergen,
> 
> Juergen> On 19/11/16 19:22, Quentin Lambert wrote:
>>> Most error branches following the call to kmalloc contain a call to
>>> kfree. This patch add these calls where they are missing.
>>>
>>> This issue was found with Hector.
>>>
>>> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
> 
> Juergen> Nice catch. I think this will need some more work, I'll do a
> Juergen> follow-on patch.
> 
> Juergen> Reviewed-by: Juergen Gross <jgross@suse.com>
> 
> Are you taking this patch through the Xen tree or should I queue it up?

I'm taking it through the xen tree, thanks.


Juergen


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] xen-scsifront: Add a missing call to kfree
       [not found] <20161119182256.9081-1-lambert.quentin@gmail.com>
  2016-11-21  6:01 ` [PATCH] xen-scsifront: Add a missing call to kfree Juergen Gross
       [not found] ` <1320a162-dc36-5833-a746-367134dae5e7@suse.com>
@ 2016-11-24  8:24 ` Juergen Gross
  2 siblings, 0 replies; 9+ messages in thread
From: Juergen Gross @ 2016-11-24  8:24 UTC (permalink / raw)
  To: Quentin Lambert, Boris Ostrovsky, David Vrabel,
	James E.J. Bottomley, Martin K. Petersen, xen-devel, linux-scsi,
	linux-kernel, kernel-janitors

On 19/11/16 19:22, Quentin Lambert wrote:
> Most error branches following the call to kmalloc contain
> a call to kfree. This patch add these calls where they are
> missing.
> 
> This issue was found with Hector.
> 
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

Applied to xen/tip.git for-linus-4.10


Juergen

> 
> ---
>  drivers/scsi/xen-scsifront.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- a/drivers/scsi/xen-scsifront.c
> +++ b/drivers/scsi/xen-scsifront.c
> @@ -627,6 +627,7 @@ static int scsifront_action_handler(stru
>  
>  	if (scsifront_enter(info)) {
>  		spin_unlock_irq(host->host_lock);
> +		kfree(shadow);
>  		return FAILED;
>  	}
>  
> 
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] xen-scsifront: Add a missing call to kfree
       [not found] ` <1320a162-dc36-5833-a746-367134dae5e7@suse.com>
  2016-11-22  3:40   ` Martin K. Petersen
       [not found]   ` <yq1twb0yygf.fsf@sermon.lab.mkp.net>
@ 2016-11-25 21:28   ` Dan Carpenter
  2016-12-05 20:53   ` Dan Carpenter
       [not found]   ` <20161205205348.GA31465@mwanda>
  4 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2016-11-25 21:28 UTC (permalink / raw)
  To: Juergen Gross
  Cc: James E.J. Bottomley, linux-scsi, Martin K. Petersen,
	Quentin Lambert, kernel-janitors, linux-kernel, David Vrabel,
	xen-devel, Boris Ostrovsky

On Mon, Nov 21, 2016 at 07:01:36AM +0100, Juergen Gross wrote:
> On 19/11/16 19:22, Quentin Lambert wrote:
> > Most error branches following the call to kmalloc contain
> > a call to kfree. This patch add these calls where they are
> > missing.
> > 
> > This issue was found with Hector.
> > 
> > Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
> 
> Nice catch. I think this will need some more work, I'll do a
> follow-on patch.

Yeah.  It's weird how we free it on the success path and all the failure
paths except one.  But it looks so deliberate.  What's going on with
that?

Could you send your follow on patch as a reply to the thread?

regards,
dan carpenter


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] xen-scsifront: Add a missing call to kfree
       [not found] ` <1320a162-dc36-5833-a746-367134dae5e7@suse.com>
                     ` (2 preceding siblings ...)
  2016-11-25 21:28   ` Dan Carpenter
@ 2016-12-05 20:53   ` Dan Carpenter
       [not found]   ` <20161205205348.GA31465@mwanda>
  4 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2016-12-05 20:53 UTC (permalink / raw)
  To: Juergen Gross
  Cc: James E.J. Bottomley, linux-scsi, Martin K. Petersen,
	Quentin Lambert, kernel-janitors, linux-kernel, David Vrabel,
	xen-devel, Boris Ostrovsky

On Mon, Nov 21, 2016 at 07:01:36AM +0100, Juergen Gross wrote:
> On 19/11/16 19:22, Quentin Lambert wrote:
> > Most error branches following the call to kmalloc contain
> > a call to kfree. This patch add these calls where they are
> > missing.
> > 
> > This issue was found with Hector.
> > 
> > Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
> 
> Nice catch. I think this will need some more work, I'll do a
> follow-on patch.
> 

The error handling is really weird.  Could you send your follow on to
this thread?

regards,
dan carpenter


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] xen-scsifront: Add a missing call to kfree
       [not found]   ` <20161205205348.GA31465@mwanda>
@ 2016-12-06  5:45     ` Juergen Gross
       [not found]     ` <9aef1d68-4755-e87d-4919-fb8ca4bea4fb@suse.com>
  1 sibling, 0 replies; 9+ messages in thread
From: Juergen Gross @ 2016-12-06  5:45 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: James E.J. Bottomley, linux-scsi, Martin K. Petersen,
	Quentin Lambert, kernel-janitors, linux-kernel, David Vrabel,
	xen-devel, Boris Ostrovsky

On 05/12/16 21:53, Dan Carpenter wrote:
> On Mon, Nov 21, 2016 at 07:01:36AM +0100, Juergen Gross wrote:
>> On 19/11/16 19:22, Quentin Lambert wrote:
>>> Most error branches following the call to kmalloc contain
>>> a call to kfree. This patch add these calls where they are
>>> missing.
>>>
>>> This issue was found with Hector.
>>>
>>> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
>>
>> Nice catch. I think this will need some more work, I'll do a
>> follow-on patch.
>>
> 
> The error handling is really weird.  Could you send your follow on to
> this thread?

I did:

https://lkml.org/lkml/2016/12/2/17


Juergen


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] xen-scsifront: Add a missing call to kfree
       [not found]     ` <9aef1d68-4755-e87d-4919-fb8ca4bea4fb@suse.com>
@ 2016-12-06 10:22       ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2016-12-06 10:22 UTC (permalink / raw)
  To: Juergen Gross
  Cc: James E.J. Bottomley, linux-scsi, Martin K. Petersen,
	Quentin Lambert, kernel-janitors, linux-kernel, David Vrabel,
	xen-devel, Boris Ostrovsky

Oops.  Sorry for the noise.

regards,
dan carpenter



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-12-06 10:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20161119182256.9081-1-lambert.quentin@gmail.com>
2016-11-21  6:01 ` [PATCH] xen-scsifront: Add a missing call to kfree Juergen Gross
     [not found] ` <1320a162-dc36-5833-a746-367134dae5e7@suse.com>
2016-11-22  3:40   ` Martin K. Petersen
     [not found]   ` <yq1twb0yygf.fsf@sermon.lab.mkp.net>
2016-11-22  5:19     ` Juergen Gross
2016-11-25 21:28   ` Dan Carpenter
2016-12-05 20:53   ` Dan Carpenter
     [not found]   ` <20161205205348.GA31465@mwanda>
2016-12-06  5:45     ` Juergen Gross
     [not found]     ` <9aef1d68-4755-e87d-4919-fb8ca4bea4fb@suse.com>
2016-12-06 10:22       ` Dan Carpenter
2016-11-24  8:24 ` Juergen Gross
2016-11-19 18:22 Quentin Lambert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).