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:   Fri, 14 Jun 2019 14:32:39 +0100
From:   Suzuki K Poulose <suzuki.poulose@....com>
To:     linux-kernel@...r.kernel.org, sebott@...ux.ibm.com,
        oberpar@...ux.ibm.com, heiko.carstens@...ibm.com
Cc:     gregkh@...uxfoundation.org, rafael@...nel.org
Subject: Re: [RFC PATCH 01/57] drivers: s390/cio: Use driver_for_each_device

Heiko, Sebastian, Peter,

Please could you review the following patch ?


On 03/06/2019 16:49, Suzuki K Poulose wrote:
> The cio driver use driver_find_device() to find all devices
> to release them before the driver is unregistered. Instead,
> it could easily use a lighter driver_for_each_device() helper
> to iterate over all the devices.
> 
> Cc: Sebastian Ott <sebott@...ux.ibm.com>
> Cc: Peter Oberparleiter <oberpar@...ux.ibm.com>
> Cc: Heiko Carstens <heiko.carstens@...ibm.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
> ---
>   drivers/s390/cio/ccwgroup.c | 18 ++++++++----------
>   1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
> index 4ebf6d4..a006945 100644
> --- a/drivers/s390/cio/ccwgroup.c
> +++ b/drivers/s390/cio/ccwgroup.c
> @@ -581,9 +581,12 @@ int ccwgroup_driver_register(struct ccwgroup_driver *cdriver)
>   }
>   EXPORT_SYMBOL(ccwgroup_driver_register);
>   
> -static int __ccwgroup_match_all(struct device *dev, void *data)
> +static int ccwgroup_release_device(struct device *dev, void *unused)
>   {
> -	return 1;
> +	struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
> +
> +	ccwgroup_ungroup(gdev);
> +	return 0;
>   }
>   
>   /**
> @@ -594,16 +597,11 @@ static int __ccwgroup_match_all(struct device *dev, void *data)
>    */
>   void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver)
>   {
> -	struct device *dev;
> +	int ret;
>   
>   	/* We don't want ccwgroup devices to live longer than their driver. */
> -	while ((dev = driver_find_device(&cdriver->driver, NULL, NULL,
> -					 __ccwgroup_match_all))) {
> -		struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
> -
> -		ccwgroup_ungroup(gdev);
> -		put_device(dev);
> -	}
> +	ret = driver_for_each_device(&cdriver->driver, NULL, NULL,
> +				     ccwgroup_release_device);
>   	driver_unregister(&cdriver->driver);
>   }
>   EXPORT_SYMBOL(ccwgroup_driver_unregister);
> 


Thanks
Suzuki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ