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:   Wed, 16 Nov 2022 10:22:18 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
Cc:     Thierry Reding <thierry.reding@...il.com>,
        linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel@...gutronix.de
Subject: Re: [PATCH 1/4] pwm: Document variables protected by pwm_lock

On Tue, Nov 15, 2022 at 10:15:12PM +0100, Uwe Kleine-König wrote:
> To simplify validation of the used locking, document for the global pwm
> mutex what it actually protects against concurrent access. Also note for
> two functions modifying these that pwm_lock is held by the caller.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> ---
>  drivers/pwm/core.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> index d333e7422f4a..ebe06efe9de5 100644
> --- a/drivers/pwm/core.c
> +++ b/drivers/pwm/core.c
> @@ -27,7 +27,10 @@
>  
>  static DEFINE_MUTEX(pwm_lookup_lock);
>  static LIST_HEAD(pwm_lookup_list);
> +
> +/* protects access to pwm_chips, allocated_pwms, and pwm_tree */
>  static DEFINE_MUTEX(pwm_lock);
> +
>  static LIST_HEAD(pwm_chips);
>  static DECLARE_BITMAP(allocated_pwms, MAX_PWMS);
>  static RADIX_TREE(pwm_tree, GFP_KERNEL);
> @@ -37,6 +40,7 @@ static struct pwm_device *pwm_to_device(unsigned int pwm)
>  	return radix_tree_lookup(&pwm_tree, pwm);
>  }
>  
> +/* Called with pwm_lock held */
>  static int alloc_pwms(unsigned int count)
>  {
>  	unsigned int start;
> @@ -50,6 +54,7 @@ static int alloc_pwms(unsigned int count)
>  	return start;
>  }
>  
> +/* Called with pwm_lock held */
>  static void free_pwms(struct pwm_chip *chip)
>  {
>  	unsigned int i;
> -- 
> 2.38.1
> 

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ