Bug 13326 - [PATCH]Null pointer dereference in rtc-cmos driver
[PATCH]Null pointer dereference in rtc-cmos driver
Status: CLOSED CODE_FIX
Product: Drivers
Classification: Unclassified
Component: Other
All Linux
: P1 normal
Assigned To: drivers_other
:
Depends on:
Blocks: 13070
  Show dependency treegraph
 
Reported: 2009-05-16 21:28 UTC by Rafael J. Wysocki
Modified: 2009-05-30 21:31 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.30-rc5
Tree: Mainline
Regression: Yes


Attachments
Driver Core: do not oops when driver_unregister() is called for unregistered drivers (1.69 KB, patch)
2009-05-24 22:18 UTC, Rafael J. Wysocki
Details | Diff

Description Rafael J. Wysocki 2009-05-16 21:28:15 UTC
Subject    : [BUG 2.6.30_rc5] Null pointer dereference in rtc-cmos driver
Submitter  : Ozan Çağlayan <ozan@pardus.org.tr>
Date       : 2009-05-14 16:16
References : http://marc.info/?l=linux-kernel&m=124231783704696&w=4

This entry is being used for tracking a regression from 2.6.29.  Please don't
close it until the problem is fixed in the mainline.
Comment 1 Janboe Ye 2009-05-17 15:00:07 UTC
This is because rtc-cmos driver continues when pnp_register_driver(&cmos_pnp_driver) fail.

My patch fixes this bug.

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 23e10b6..da132f6 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)
+               return retval;
 #endif
 
        if (!cmos_rtc.dev)
Comment 2 Rafael J. Wysocki 2009-05-24 22:18:44 UTC
Created attachment 21523 [details]
Driver Core: do not oops when driver_unregister() is called for unregistered drivers

Handled-By : Kay Sievers <kay.sievers@vrfy.org>
Comment 3 Rafael J. Wysocki 2009-05-24 22:19:24 UTC
Patch : http://bugzilla.kernel.org/attachment.cgi?id=21523
Comment 4 Rafael J. Wysocki 2009-05-30 21:31:55 UTC
Fixed by commit 5c8563d773c0e9f0ac2a552e84806decd98ce732 .

Note You need to log in before you can comment on or make changes to this bug.