lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 8 Sep 2020 15:03:28 +0300
From:   Peter Ujfalusi <peter.ujfalusi@...com>
To:     Camel Guo <camel.guo@...s.com>, <lgirdwood@...il.com>,
        <broonie@...nel.org>, <tiwai@...e.com>, <dmurphy@...com>
CC:     <alsa-devel@...a-project.org>, <kernel@...s.com>,
        <linux-kernel@...r.kernel.org>, Camel Guo <camelg@...s.com>
Subject: Re: [PATCH 1/2] ASoC: tlv320adcx140: Avoid accessing invalid
 gpio_reset

Hi,

On 08/09/2020 14.59, Peter Ujfalusi wrote:
> 
> 
> On 08/09/2020 11.35, Camel Guo wrote:
>> From: Camel Guo <camelg@...s.com>
>>
>> When gpio_reset is not well defined in devicetree, the
>> adcx140->gpio_reset is an error code instead of NULL. In this case,
>> adcx140->gpio_reset should not be used by adcx140_reset. This commit
>> sets it NULL to avoid accessing an invalid variable.
>>
>> Signed-off-by: Camel Guo <camelg@...s.com>
>> ---
>>  sound/soc/codecs/tlv320adcx140.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
>> index 7ae6ec374be3..597dd1062943 100644
>> --- a/sound/soc/codecs/tlv320adcx140.c
>> +++ b/sound/soc/codecs/tlv320adcx140.c
>> @@ -984,8 +984,10 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
>>  
>>  	adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev,
>>  						      "reset", GPIOD_OUT_LOW);
>> -	if (IS_ERR(adcx140->gpio_reset))
>> +	if (IS_ERR(adcx140->gpio_reset) || adcx140->gpio_reset == NULL) {
>>  		dev_info(&i2c->dev, "Reset GPIO not defined\n");
>> +		adcx140->gpio_reset = NULL;
> 
> the correct fix is to:
> 	dev_err(&i2c->dev, "Reset GPIO not defined\n");

no need to print, I think gpio core will do that.

> 	return PTR_ERR(adcx140->gpio_reset);
> 
> If the reset GPIO is specified and you get error when requesting it as
> optional, there is a reason for that.
> For example deferred probing.
> 
>> +	}
>>  
>>  	adcx140->supply_areg = devm_regulator_get_optional(adcx140->dev,
>>  							   "areg");
>>
> 
> - Péter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ