[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070402105553.GA12153@flint.arm.linux.org.uk>
Date: Mon, 2 Apr 2007 11:55:53 +0100
From: Russell King <rmk+lkml@....linux.org.uk>
To: David Brownell <david-b@...bell.net>
Cc: Greg KH <gregkh@...e.de>,
Linux Kernel list <linux-kernel@...r.kernel.org>,
Andres Salomon <dilinger@...ian.org>
Subject: Re: [patch 2.6.21-rc5-git 1/2] fix hotplug for legacy platform drivers
On Sat, Mar 31, 2007 at 02:55:38PM -0700, David Brownell wrote:
> --- g26.orig/drivers/pcmcia/pxa2xx_mainstone.c 2007-03-30 16:44:04.000000000 -0700
> +++ g26/drivers/pcmcia/pxa2xx_mainstone.c 2007-03-31 14:23:56.000000000 -0700
> @@ -175,6 +175,8 @@ static int __init mst_pcmcia_init(void)
> if (!mst_pcmcia_device)
> return -ENOMEM;
>
> + /* REVISIT just statically allocate the device */
> + mst_pcmcia_device->dev.uevent_suppress = 0;
Such a comment indicates that you clearly do not understand why these
platform devices are dynamically allocated.
These are modules. If they were statically allocated, then you have a
potential oops waiting to happen if you have the right ordering of user
accesses to sysfs coupled with an inopportune unload of such a driver -
the memory backing the platform device will be unexpectedly released
resulting in an access to freed memory.
The dynamic allocation interfaces for platform devices is there to
allow drivers to properly conform to the sysfs lifetime rules.
Any module statically allocating a device structure is just simply buggy.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
-
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