mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Corey Minyard <minyard@acm.org>
Cc: Arjan van de Ven <arjan@infradead.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	Yani Ioannou <yani.ioannou@gmail.com>
Subject: Re: [PATCH] Fix release function in IPMI device model
Date: Wed, 22 Mar 2006 19:23:45 +0000	[thread overview]
Message-ID: <20060322192345.GB26357@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20060322155742.GA28674@i2.minyard.local>

On Wed, Mar 22, 2006 at 09:57:42AM -0600, Corey Minyard wrote:
> @@ -1800,7 +1802,7 @@ static struct bmc_device *ipmi_find_bmc_
>  
>  static void ipmi_bmc_release(struct device *dev)
>  {
> -	printk(KERN_DEBUG "ipmi_bmc release\n");
> +	kfree(to_bmc_device(to_platform_device(dev)));
>  }
>  
>  static ssize_t device_id_show(struct device *dev,

Okay, so the release function is in the same module as the code which
is unregistering it.  No, wrong.

What this means is that if you rmmod this module, but userspace has
some file associated with the platform device still open, and then it
drops that refcount, your release function will be called.

But wait, the module code has been unmapped.  Instant oops.

Use the additions to the platform device API to sanely handle platform
devices, and don't try to wrap a platform device up into some other
data structure.

There's comments on lkml about this additional platform device API
(search for platform_device_alloc) or in the git commit comments.
I don't have any references to either to hand, sorry.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

      reply	other threads:[~2006-03-22 19:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-22 15:57 Corey Minyard
2006-03-22 19:23 ` Russell King [this message]

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=20060322192345.GB26357@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    --cc=yani.ioannou@gmail.com \
    /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®