[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac3eb2510905161636j5137717crdb72ea94e846d4b9@mail.gmail.com>
Date: Sun, 17 May 2009 01:36:17 +0200
From: Kay Sievers <kay.sievers@...y.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Alessandro Zummo <alessandro.zummo@...ertech.it>,
rtc-linux@...glegroups.com, mingo@...e.hu,
Ozan Çağlayan <ozan@...dus.org.tr>,
David Brownell <david-b@...bell.net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Greg KH <greg@...ah.com>, Tejun Heo <tj@...nel.org>
Subject: Re: [rtc-linux] Re: [BUG 2.6.30_rc5] Null pointer dereference in
rtc-cmos driver
On Sun, May 17, 2009 at 00:49, Andrew Morton <akpm@...ux-foundation.org> wrote:
> This should fix the symptoms:
> +++ a/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
That looks like a good fix.
> Can someone please test it?
I'll try to reproduce it.
>> > > [ 10.428728] BUG: unable to handle kernel NULL pointer dereference at 00000018
...
>> > > [ 10.459009] [<c03037e6>] ? driver_remove_file+0xf/0x11
> But we have arguably multiple more bugs here.
> pnp_unregister_driver(unregistered-driver) shouldn't oops the kernel.
> Neither pnp_unregister_driver() nor driver_unregister() nor
> bus_remove_driver() nor driver_remove_file() nor sysfs_remove_file()
> detected this.
>
> Kay, Greg: there are already a pile of checks on that path, but it
> seems there's one missing. Could you please take a look and decide at
> the design level where this check should be occurring?
The issue is caused by a trying to unregister a driver which never got
registered before. I guess we try to access the private part of the
driver to reach the kobject, but for unregistered drivers there is no
such thing at that time. In:
driver_remove_file()
we try to access the private part:
sysfs_remove_file(&drv->p->kobj, ...
and that is NULL, for an unregistered driver, I would expect.
I'll try to reproduce the issue, and see if your fix cover the real problem.
If I can reproduce it, I'll take a look where to add a check for this.
Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists