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: <8dd4f326-9751-911a-0567-62413c7756f6@linaro.org>
Date:   Wed, 7 Jun 2017 16:30:52 +0100
From:   Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To:     Heiner Kallweit <hkallweit1@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] nvmem: core: remove member users from struct
 nvmem_device



On 04/06/17 12:01, Heiner Kallweit wrote:
> Member users is used only to check whether we're allowed to remove
> the module. So in case of built-in it's not used at all and in case

nvmem providers doesn't have to be independent drivers, providers could 
be part of the other driver which can dynamically register and 
unregister nvmem providers. For example at24 and at25 drivers.

This patch will break such cases !!



> that owner is a module we have the module refcount for the same
> purpose already. Whenever users is incremented the owner's refcount
> is incremented too. Therefore users isn't needed.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
> ---
>  drivers/nvmem/core.c | 16 ----------------
>  1 file changed, 16 deletions(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 8c830a80..4e07f3f8 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -33,7 +33,6 @@ struct nvmem_device {
>  	int			word_size;
>  	int			ncells;
>  	int			id;
> -	int			users;
>  	size_t			size;
>  	bool			read_only;
>  	int			flags;
> @@ -517,13 +516,6 @@ EXPORT_SYMBOL_GPL(nvmem_register);
>   */
>  int nvmem_unregister(struct nvmem_device *nvmem)
>  {
> -	mutex_lock(&nvmem_mutex);
> -	if (nvmem->users) {
> -		mutex_unlock(&nvmem_mutex);
> -		return -EBUSY;
> -	}
> -	mutex_unlock(&nvmem_mutex);
> -
>  	if (nvmem->flags & FLAG_COMPAT)
>  		device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom);
>
> @@ -562,7 +554,6 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np,
>  		}
>  	}
>
> -	nvmem->users++;
>  	mutex_unlock(&nvmem_mutex);
>
>  	if (!try_module_get(nvmem->owner)) {
> @@ -570,10 +561,6 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np,
>  			"could not increase module refcount for cell %s\n",
>  			nvmem->name);
>
> -		mutex_lock(&nvmem_mutex);
> -		nvmem->users--;
> -		mutex_unlock(&nvmem_mutex);
> -
>  		return ERR_PTR(-EINVAL);
>  	}
>
> @@ -583,9 +570,6 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np,
>  static void __nvmem_device_put(struct nvmem_device *nvmem)
>  {
>  	module_put(nvmem->owner);
> -	mutex_lock(&nvmem_mutex);
> -	nvmem->users--;
> -	mutex_unlock(&nvmem_mutex);
>  }
>
>  static int nvmem_match(struct device *dev, void *data)
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ