RE: [PATCH] Thermal: Fix synchronization issues in thermal_sys.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rui,

> -----Original Message-----
> From: linux-acpi-owner@xxxxxxxxxxxxxxx [mailto:linux-acpi-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Zhang Rui
> Sent: Thursday, September 27, 2012 11:45 AM
> To: R, Durgadoss
> Cc: lenb@xxxxxxxxxx; linux-acpi@xxxxxxxxxxxxxxx;
> dan.carpenter@xxxxxxxxxx; hughd@xxxxxxxxxx; linux-
> next@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] Thermal: Fix synchronization issues in thermal_sys.c
> 
> On 四, 2012-09-27 at 11:38 +0530, Durgadoss R wrote:
> > This patch fixes the following mutex and NULL pointer
> > problems in thermal_sys.c:
> >  * mutex_unlock fix in update_temperature function
> >  * mutex_unlock/NULL check fix in bind_cdev function
> >  * NULL check fix in bind_tz function
> >
> > Signed-off-by: Durgadoss R <durgadoss.r@xxxxxxxxx>
> > ---
> >  drivers/thermal/thermal_sys.c |    9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
> > index 4f77d89..848553d 100644
> > --- a/drivers/thermal/thermal_sys.c
> > +++ b/drivers/thermal/thermal_sys.c
> > @@ -252,8 +252,8 @@ static void bind_cdev(struct thermal_cooling_device
> *cdev)
> >  		}
> >
> >  		tzp = pos->tzp;
> > -		if (!tzp->tbp)
> > -			return;
> > +		if (!tzp || !tzp->tbp)
> > +			continue;
> >
> >  		for (i = 0; i < tzp->num_tbps; i++) {
> >  			if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
> > @@ -289,7 +289,7 @@ static void bind_tz(struct thermal_zone_device *tz)
> >  		goto exit;
> >  	}
> >
> > -	if (!tzp->tbp)
> > +	if (!tzp || !tzp->tbp)
> >  		goto exit;
> >
> actually, this is not a problem.
> I checked the code just now, tzp can not be NULL if the code runs here.

I agree, I saw a similar kind of change needed in bind_tz, and hence
added it here. Should we carry it as such ? or you want me to refresh by
changing it ?

Thanks for looking into this quickly.

Thanks,
Durga
��.n��������+%������w��{.n�����{�����ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux