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] [day] [month] [year] [list]
Date:   Thu, 18 Apr 2019 21:32:10 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Borislav Petkov <bp@...en8.de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH] driver core: Clarify which counterparts to use to device_add()

On Thu, Apr 18, 2019 at 7:42 PM Borislav Petkov <bp@...en8.de> wrote:
>
> From: Borislav Petkov <bp@...e.de>
>
> It is not absolutely clear from the docs how the cleanup path after
> device_add() should look like so spell it out explicitly.
>
> No functional changes, just documentation.
>
> Signed-off-by: Borislav Petkov <bp@...e.de>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

> ---
>  drivers/base/core.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 4aeaa0c92bda..fd7511e04e62 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1999,6 +1999,11 @@ static int device_private_init(struct device *dev)
>   * NOTE: _Never_ directly free @dev after calling this function, even
>   * if it returned an error! Always use put_device() to give up your
>   * reference instead.
> + *
> + * Rule of thumb is: if device_add() succeeds, you should call
> + * device_del() when you want to get rid of it. If device_add() has
> + * *not* succeeded, use *only* put_device() to drop the reference
> + * count.
>   */
>  int device_add(struct device *dev)
>  {
> --
> 2.21.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ