mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: David Brownell <david-b@pacbell.net>
Cc: Greg KH <gregkh@suse.de>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	Andres Salomon <dilinger@debian.org>
Subject: Re: [patch 2.6.21-rc5-git 1/2] fix hotplug for legacy platform drivers
Date: Mon, 2 Apr 2007 11:55:53 +0100	[thread overview]
Message-ID: <20070402105553.GA12153@flint.arm.linux.org.uk> (raw)
In-Reply-To: <200703311455.38490.david-b@pacbell.net>

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:

  parent reply	other threads:[~2007-04-02 10:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-31 21:55 David Brownell
2007-04-02 10:49 ` Cornelia Huck
2007-04-02 16:59   ` David Brownell
2007-04-03  8:52     ` Cornelia Huck
2007-04-02 10:55 ` Russell King [this message]
2007-04-02 16:39   ` David Brownell
2007-04-02 20:10 ` Dmitry Torokhov
2007-04-02 20:17   ` David Brownell

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=20070402105553.GA12153@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=david-b@pacbell.net \
    --cc=dilinger@debian.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.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

Powered by JetHome