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: <20201213013651.GA59715@roeck-us.net>
Date:   Sat, 12 Dec 2020 17:36:51 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>, linux-kernel@...r.kernel.org,
        Marek Szyprowski <m.szyprowski@...sung.com>
Subject: Re: [PATCH v3] driver core: platform: don't oops in
 platform_shutdown() on unbound devices

On Sun, Dec 13, 2020 at 02:55:33AM +0300, Dmitry Baryshkov wrote:
> On shutdown the driver core calls the bus' shutdown callback also for
> unbound devices. A driver's shutdown callback however is only called for
> devices bound to this driver. Commit 9c30921fe799 ("driver core:
> platform: use bus_type functions") changed the platform bus from driver
> callbacks to bus callbacks, so the shutdown function must be prepared to
> be called without a driver. Add the corresponding check in the shutdown
> function.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> Fixes: 9c30921fe799 ("driver core: platform: use bus_type functions")

Tested-by: Guenter Roeck <linux@...ck-us.net>

> ---
>  drivers/base/platform.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 0358dc3ea3ad..e9477e0bbca5 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -1351,9 +1351,13 @@ static int platform_remove(struct device *_dev)
>  
>  static void platform_shutdown(struct device *_dev)
>  {
> -	struct platform_driver *drv = to_platform_driver(_dev->driver);
>  	struct platform_device *dev = to_platform_device(_dev);
> +	struct platform_driver *drv;
> +
> +	if (!_dev->driver)
> +		return;
>  
> +	drv = to_platform_driver(_dev->driver);
>  	if (drv->shutdown)
>  		drv->shutdown(dev);
>  }
> -- 
> 2.29.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ