diff mbox

[3/9] rtc: fix null pointer dereference

Message ID 20090620160851.6953.95273.stgit@i1501.lan.towertech.it
State Not Applicable, archived
Headers show

Commit Message

Alessandro Zummo June 20, 2009, 4:08 p.m. UTC
From: Andrew Morton <akpm@linux-foundation.org>

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=13326

Prevents a null-pointer deref under the above-described circumstances.

pnp_unregister_driver() shouldn't oops the kernel either - that's a

Reported-by: <ozan@pardus.org.tr>
Cc: Alessandro Zummo <alessandro.zummo@towertech.it>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: David Brownell <david-b@pacbell.net>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Tested-by: Ozan Caglayan <ozan@pardus.org.tr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
---

 drivers/rtc/rtc-cmos.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---

Comments

Andrew Morton June 26, 2009, 11:01 p.m. UTC | #1
On Sat, 20 Jun 2009 18:08:51 +0200
Alessandro Zummo <a.zummo@towertech.it> wrote:

> From: Andrew Morton <akpm@linux-foundation.org>
> 
> Addresses http://bugzilla.kernel.org/show_bug.cgi?id=13326
> 
> Prevents a null-pointer deref under the above-described circumstances.
> 
> pnp_unregister_driver() shouldn't oops the kernel either - that's a
> 
> Reported-by: <ozan@pardus.org.tr>
> Cc: Alessandro Zummo <alessandro.zummo@towertech.it>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: David Brownell <david-b@pacbell.net>
> Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
> Tested-by: Ozan Caglayan <ozan@pardus.org.tr>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
> ---
> 
>  drivers/rtc/rtc-cmos.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
> index 23e10b6..4b55dab 100644
> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
> @@ -1179,7 +1179,9 @@ static int __init cmos_init(void)
>  	int retval = 0;
>  
>  #ifdef	CONFIG_PNP
> -	pnp_register_driver(&cmos_pnp_driver);
> +	retval = pnp_register_driver(&cmos_pnp_driver);
> +	if (retval < 0)
> +		return retval;
>  #endif
>  
>  	if (!cmos_rtc.dev)

During the discussion Linus ended up deciding that this wasn't the
right change - iirc pnp_register_driver() failures could occur under
some conditions, but the driver works OK anyway.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---
diff mbox

Patch

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 23e10b6..4b55dab 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -1179,7 +1179,9 @@  static int __init cmos_init(void)
 	int retval = 0;
 
 #ifdef	CONFIG_PNP
-	pnp_register_driver(&cmos_pnp_driver);
+	retval = pnp_register_driver(&cmos_pnp_driver);
+	if (retval < 0)
+		return retval;
 #endif
 
 	if (!cmos_rtc.dev)