public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PNP: add a put_device() in isapnp_init()
@ 2025-12-18  8:36 Haoxiang Li
  2025-12-18 11:23 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2025-12-18  8:36 UTC (permalink / raw)
  To: perex, rafael; +Cc: linux-acpi, linux-kernel, Haoxiang Li, stable

if pnp_register_protocol() fails, call put_device()
to drop the device reference.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/pnp/isapnp/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 219f96f2aaaf..d6daab7ed59e 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -983,8 +983,10 @@ static int __init isapnp_init(void)
 		return -EBUSY;
 	}
 
-	if (pnp_register_protocol(&isapnp_protocol) < 0)
+	if (pnp_register_protocol(&isapnp_protocol) < 0) {
+		put_device(&isapnp_protocol.dev);
 		return -EBUSY;
+	}
 
 	/*
 	 *      Print a message. The existing ISAPnP code is hanging machines
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PNP: add a put_device() in isapnp_init()
  2025-12-18  8:36 [PATCH] PNP: add a put_device() in isapnp_init() Haoxiang Li
@ 2025-12-18 11:23 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2025-12-18 11:23 UTC (permalink / raw)
  To: Haoxiang Li; +Cc: perex, rafael, linux-acpi, linux-kernel, stable

On Thu, Dec 18, 2025 at 04:36:46PM +0800, Haoxiang Li wrote:
> if pnp_register_protocol() fails, call put_device()
> to drop the device reference.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
>  drivers/pnp/isapnp/core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
> index 219f96f2aaaf..d6daab7ed59e 100644
> --- a/drivers/pnp/isapnp/core.c
> +++ b/drivers/pnp/isapnp/core.c
> @@ -983,8 +983,10 @@ static int __init isapnp_init(void)
>  		return -EBUSY;
>  	}
>  
> -	if (pnp_register_protocol(&isapnp_protocol) < 0)
> +	if (pnp_register_protocol(&isapnp_protocol) < 0) {
> +		put_device(&isapnp_protocol.dev);

Same here, this feels very wrong.

How was this tested?

How was this found?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-18 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-18  8:36 [PATCH] PNP: add a put_device() in isapnp_init() Haoxiang Li
2025-12-18 11:23 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox