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: <CAHUa44FFSx+F=ym+cTXCRpiF7it-OXkXVbf_GYW9AYd2_xOe=w@mail.gmail.com>
Date: Mon, 14 Oct 2024 12:39:38 +0200
From: Jens Wiklander <jens.wiklander@...aro.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Arnd Bergmann <arnd@...db.de>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 2/2] rpmb: Remove some useless locking

On Wed, Oct 9, 2024 at 10:53 PM Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
>
> There is no need for explicit locking when using the ida API, as stated in
> the doc related to ida_alloc_range() / ida_free().
>
> So remove rpmb_mutex.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> See:
> https://elixir.bootlin.com/linux/v6.11.2/source/lib/idr.c#L375
> https://elixir.bootlin.com/linux/v6.11.2/source/lib/idr.c#L484
> ---
>  drivers/misc/rpmb-core.c | 5 -----
>  1 file changed, 5 deletions(-)

I'm picking up this for v6.13.

Thanks,
Jens

>
> diff --git a/drivers/misc/rpmb-core.c b/drivers/misc/rpmb-core.c
> index ad1b5c1a37fa..2d653926cdbb 100644
> --- a/drivers/misc/rpmb-core.c
> +++ b/drivers/misc/rpmb-core.c
> @@ -13,7 +13,6 @@
>  #include <linux/slab.h>
>
>  static DEFINE_IDA(rpmb_ida);
> -static DEFINE_MUTEX(rpmb_mutex);
>
>  /**
>   * rpmb_dev_get() - increase rpmb device ref counter
> @@ -63,9 +62,7 @@ static void rpmb_dev_release(struct device *dev)
>  {
>         struct rpmb_dev *rdev = to_rpmb_dev(dev);
>
> -       mutex_lock(&rpmb_mutex);
>         ida_free(&rpmb_ida, rdev->id);
> -       mutex_unlock(&rpmb_mutex);
>         kfree(rdev->descr.dev_id);
>         kfree(rdev);
>  }
> @@ -175,9 +172,7 @@ struct rpmb_dev *rpmb_dev_register(struct device *dev,
>                 goto err_free_rdev;
>         }
>
> -       mutex_lock(&rpmb_mutex);
>         ret = ida_alloc(&rpmb_ida, GFP_KERNEL);
> -       mutex_unlock(&rpmb_mutex);
>         if (ret < 0)
>                 goto err_free_dev_id;
>         rdev->id = ret;
> --
> 2.46.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ