All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] hwmon: (coretemp) Avoid leaving around
@ 2011-09-24 22:33 Guenter Roeck
  2011-09-28 12:27 ` Jean Delvare
  2011-09-28 15:16 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2011-09-24 22:33 UTC (permalink / raw)
  To: lm-sensors

Storing the struct temp_data pointer allocated from create_core_data()
when returning an error has the potential of leaving around a pointer
to freed memory. Reset it to NULL for error returns.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
---
I want to send the pending patches to Linus, and include a fix for the problem
reported by Jan. So here it is.

 drivers/hwmon/coretemp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 44b2391..5100b01 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -508,6 +508,7 @@ static int create_core_data(struct platform_device *pdev,
 
 	return 0;
 exit_free:
+	pdata->core_data[attr_no] = NULL;
 	kfree(tdata);
 	return err;
 }
-- 
1.7.3.1


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH] hwmon: (coretemp) Avoid leaving around
  2011-09-24 22:33 [lm-sensors] [PATCH] hwmon: (coretemp) Avoid leaving around Guenter Roeck
@ 2011-09-28 12:27 ` Jean Delvare
  2011-09-28 15:16 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2011-09-28 12:27 UTC (permalink / raw)
  To: lm-sensors

Hi Guenter,

Once again sorry for the late review. At this rate I'm going to add
this to my signature :(

On Sat, 24 Sep 2011 15:33:09 -0700, Guenter Roeck wrote:
> Storing the struct temp_data pointer allocated from create_core_data()
> when returning an error has the potential of leaving around a pointer
> to freed memory. Reset it to NULL for error returns.
> 
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
> ---
> I want to send the pending patches to Linus, and include a fix for the problem
> reported by Jan. So here it is.
> 
>  drivers/hwmon/coretemp.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> index 44b2391..5100b01 100644
> --- a/drivers/hwmon/coretemp.c
> +++ b/drivers/hwmon/coretemp.c
> @@ -508,6 +508,7 @@ static int create_core_data(struct platform_device *pdev,
>  
>  	return 0;
>  exit_free:
> +	pdata->core_data[attr_no] = NULL;
>  	kfree(tdata);
>  	return err;
>  }

Yes, obviously correct and the right thing to do.

Acked-by: Jean Delvare <khali@linux-fr.org>

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH] hwmon: (coretemp) Avoid leaving around
  2011-09-24 22:33 [lm-sensors] [PATCH] hwmon: (coretemp) Avoid leaving around Guenter Roeck
  2011-09-28 12:27 ` Jean Delvare
@ 2011-09-28 15:16 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2011-09-28 15:16 UTC (permalink / raw)
  To: lm-sensors

On Wed, Sep 28, 2011 at 08:27:52AM -0400, Jean Delvare wrote:
> Hi Guenter,
> 
> Once again sorry for the late review. At this rate I'm going to add
> this to my signature :(
> 
> On Sat, 24 Sep 2011 15:33:09 -0700, Guenter Roeck wrote:
> > Storing the struct temp_data pointer allocated from create_core_data()
> > when returning an error has the potential of leaving around a pointer
> > to freed memory. Reset it to NULL for error returns.
> > 
> > Reported-by: Jan Beulich <jbeulich@suse.com>
> > Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
> > ---
> > I want to send the pending patches to Linus, and include a fix for the problem
> > reported by Jan. So here it is.
> > 
> >  drivers/hwmon/coretemp.c |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> > index 44b2391..5100b01 100644
> > --- a/drivers/hwmon/coretemp.c
> > +++ b/drivers/hwmon/coretemp.c
> > @@ -508,6 +508,7 @@ static int create_core_data(struct platform_device *pdev,
> >  
> >  	return 0;
> >  exit_free:
> > +	pdata->core_data[attr_no] = NULL;
> >  	kfree(tdata);
> >  	return err;
> >  }
> 
> Yes, obviously correct and the right thing to do.
> 
> Acked-by: Jean Delvare <khali@linux-fr.org>
> 
Better late than never ... thanks, applied.

Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

end of thread, other threads:[~2011-09-28 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-24 22:33 [lm-sensors] [PATCH] hwmon: (coretemp) Avoid leaving around Guenter Roeck
2011-09-28 12:27 ` Jean Delvare
2011-09-28 15:16 ` Guenter Roeck

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.