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]
Message-ID: <20200125185935.GF14064@duo.ucw.cz>
Date:   Sat, 25 Jan 2020 19:59:36 +0100
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Guenter Roeck <linux@...ck-us.net>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 309/639] hwmon: (w83627hf) Use request_muxed_region
 for Super-IO accesses

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.

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ