From: Kay Sievers <kay.sievers@vrfy.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Alessandro Zummo" <alessandro.zummo@towertech.it>,
rtc-linux@googlegroups.com, mingo@elte.hu,
"Ozan Çağlayan" <ozan@pardus.org.tr>,
"David Brownell" <david-b@pacbell.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Greg KH" <greg@kroah.com>, "Tejun Heo" <tj@kernel.org>
Subject: Re: [rtc-linux] Re: [BUG 2.6.30_rc5] Null pointer dereference in rtc-cmos driver
Date: Sun, 17 May 2009 01:36:17 +0200 [thread overview]
Message-ID: <ac3eb2510905161636j5137717crdb72ea94e846d4b9@mail.gmail.com> (raw)
In-Reply-To: <20090516154912.a0efc677.akpm@linux-foundation.org>
On Sun, May 17, 2009 at 00:49, Andrew Morton <akpm@linux-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
next prev parent reply other threads:[~2009-05-16 23:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 16:16 Ozan Çağlayan
2009-05-15 17:40 ` Ingo Molnar
2009-05-15 19:01 ` [rtc-linux] " Alessandro Zummo
2009-05-16 22:49 ` Andrew Morton
2009-05-16 23:36 ` Kay Sievers [this message]
2009-05-17 0:36 ` Kay Sievers
2009-05-17 0:26 ` Ozan Çağlayan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ac3eb2510905161636j5137717crdb72ea94e846d4b9@mail.gmail.com \
--to=kay.sievers@vrfy.org \
--cc=akpm@linux-foundation.org \
--cc=alessandro.zummo@towertech.it \
--cc=david-b@pacbell.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=ozan@pardus.org.tr \
--cc=rtc-linux@googlegroups.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®