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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 25 Jan 2020 11:14:57 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Pavel Machek <pavel@...x.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 309/639] hwmon: (w83627hf) Use request_muxed_region
 for Super-IO accesses

On 1/25/20 10:59 AM, Pavel Machek wrote:
> Hi!
>> [ Upstream commit e95fd518d05bfc087da6fcdea4900a57cfb083bd ]
>>
>> Super-IO accesses may fail on a system with no or unmapped LPC bus.
>>
>> Also, other drivers may attempt to access the LPC bus at the same time,
>> resulting in undefined behavior.
>>
>> Use request_muxed_region() to ensure that IO access on the requested
>> address space is supported, and to ensure that access by multiple drivers
>> is synchronized.
>>
> 
>> @@ -1644,9 +1654,21 @@ static int w83627thf_read_gpio5(struct platform_device *pdev)
>>   	struct w83627hf_sio_data *sio_data = dev_get_platdata(&pdev->dev);
>>   	int res = 0xff, sel;
>>   
>> -	superio_enter(sio_data);
>> +	if (superio_enter(sio_data)) {
>> +		/*
>> +		 * Some other driver reserved the address space for itself.
>> +		 * We don't want to fail driver instantiation because of that,
>> +		 * so display a warning and keep going.
>> +		 */
>> +		dev_warn(&pdev->dev,
>> +			 "Can not read VID data: Failed to enable SuperIO access\n");
>> +		return res;
>> +	}
>> +
>>   	superio_select(sio_data, W83627HF_LD_GPIO5);
>>   
>> +	res = 0xff;
>> +
> 
> This is strange. res is not actually assigned in the code above, so we
> have res = 0xff twice. Can we remove one of the initializations and do
> 'return 0xff' directly to make code more clear?
> 
> 
>> @@ -1677,7 +1699,17 @@ static int w83687thf_read_vid(struct platform_device *pdev)
>>   	struct w83627hf_sio_data *sio_data = dev_get_platdata(&pdev->dev);
>>   	int res = 0xff;
>>   
>> -	superio_enter(sio_data);
>> +	if (superio_enter(sio_data)) {
>> +		/*
>> +		 * Some other driver reserved the address space for itself.
>> +		 * We don't want to fail driver instantiation because of that,
>> +		 * so display a warning and keep going.
>> +		 */
>> +		dev_warn(&pdev->dev,
>> +			 "Can not read VID data: Failed to enable SuperIO access\n");
>> +		return res;
>> +	}
> 
> Direct "return 0xff" would make more sense here, too.
> 

Please feel free to submit a patch to improve the upstream code.

Thanks,
Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ