Skip to contentSkip to conversation

fix rtc_cmos bug

PATCH ye janboe 2 participants 4 messages May 17, 2009 – May 20, 2009 Real time clock (RTC)

lore
Share & tools
lore

ye janboe

author
#0 lore raw

fix Bug 13326 - Null pointer dereference in rtc-cmos driver
http://bugzilla.kernel.org/show_bug.cgi?id=13326

drivers/rtc/rtc-cmos.c +3 -1
index 23e10b6..da132f6 100644
@@ -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)
+               return retval;
 #endif
 
        if (!cmos_rtc.dev)
author
#1 lore raw

my fix is wrong?

Why no one ack this patch?

Thanks

Janboe

2009/5/17 ye janboe <[email protected]>:

Quoted 21 lines

   fix  Bug 13326 -  Null pointer dereference in rtc-cmos driver
   http://bugzilla.kernel.org/show_bug.cgi?id=13326

drivers/rtc/rtc-cmos.c +3 -1
index 23e10b6..da132f6 100644
@@ -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)
+               return retval;
  #endif
 
        if (!cmos_rtc.dev)
author
#3 lore raw

So if register failed, unregister is requested to invoked, right?

Anyway, thank you for your answer.

2009/5/20 Ozan Çağlayan <[email protected]>:

Quoted 19 lines

ye janboe wrote On 20-05-2009 08:17:

Quoted 9 lines

my fix is wrong?

Why no one ack this patch?

Thanks

Janboe

AFAIK any fix in a driver which causes this oops is a partial fix because the case should be handled in driver core. This is what the patch suggested does actually:

http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/driver-core.current/driver-core-do-not-oops-when-driver_unregister-is-called-for-unregistered-drivers.patch