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: <0676fcf89ca07dde911b8759b8e8b10df4bcf6cd.camel@pengutronix.de>
Date: Mon, 02 Sep 2024 12:01:01 +0200
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Herve Codina <herve.codina@...tlin.com>, Geert Uytterhoeven
 <geert@...ux-m68k.org>, Andy Shevchenko <andy.shevchenko@...il.com>, Simon
 Horman <horms@...nel.org>, Lee Jones <lee@...nel.org>, Arnd Bergmann
 <arnd@...db.de>, Derek Kiernan <derek.kiernan@....com>, Dragan Cvetic
 <dragan.cvetic@....com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Bjorn Helgaas <bhelgaas@...gle.com>, Lars Povlsen
 <lars.povlsen@...rochip.com>, Steen Hegelund
 <Steen.Hegelund@...rochip.com>,  Daniel Machon
 <daniel.machon@...rochip.com>, UNGLinuxDriver@...rochip.com, Rob Herring
 <robh@...nel.org>,  Saravana Kannan <saravanak@...gle.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>,  Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
 <pabeni@...hat.com>, Horatiu Vultur <horatiu.vultur@...rochip.com>, Andrew
 Lunn <andrew@...n.ch>,  linux-kernel@...r.kernel.org,
 netdev@...r.kernel.org, linux-pci@...r.kernel.org, 
 linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org, Allan
 Nielsen <allan.nielsen@...rochip.com>, Luca Ceresoli
 <luca.ceresoli@...tlin.com>,  Thomas Petazzoni
 <thomas.petazzoni@...tlin.com>, Clément Léger
 <clement.leger@...tlin.com>
Subject: Re: [PATCH v5 7/8] reset: core: add get_device()/put_device on rcdev

On Do, 2024-08-08 at 17:46 +0200, Herve Codina wrote:
> From: Clément Léger <clement.leger@...tlin.com>
> 
> Since the rcdev structure is allocated by the reset controller drivers
> themselves, they need to exists as long as there is a consumer. A call to
> module_get() is already existing but that does not work when using
> device-tree overlays. In order to guarantee that the underlying reset
> controller device does not vanish while using it, add a get_device() call
> when retrieving a reset control from a reset controller device and a
> put_device() when releasing that control.
> 
> Signed-off-by: Clément Léger <clement.leger@...tlin.com>
> Signed-off-by: Herve Codina <herve.codina@...tlin.com>
> ---
>  drivers/reset/core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index dba74e857be6..999c3c41cf21 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -812,6 +812,7 @@ __reset_control_get_internal(struct reset_controller_dev *rcdev,
>  	kref_init(&rstc->refcnt);
>  	rstc->acquired = acquired;
>  	rstc->shared = shared;
> +	get_device(rcdev->dev);
>  
>  	return rstc;
>  }
> @@ -826,6 +827,7 @@ static void __reset_control_release(struct kref *kref)
>  	module_put(rstc->rcdev->owner);
>  
>  	list_del(&rstc->list);
> +	put_device(rstc->rcdev->dev);
>  	kfree(rstc);
>  }

Reviewed-by: Philipp Zabel <p.zabel@...gutronix.de>

regards
Philipp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ