linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Scholz <steven.scholz@imc-berlin.de>
To: linux-ide@vger.kernel.org
Subject: NULL pointer dereference in ide_drive_remove.
Date: Thu, 19 May 2005 15:35:38 +0200	[thread overview]
Message-ID: <428C962A.2000308@imc-berlin.de> (raw)

Hi there,

(This is my first post to this list! Bear with me.)

I am working on PCMCIA IDE on an embedded ARM board (2.6.12-rc4).

After doing

~ # umount /mnt/pcmcia
~ # cardctl eject

the board crashes with

Unable to handle kernel NULL pointer dereference at virtual address 00000010
pgd = c08e8000
[00000010] *pgd=208ef031, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1]
Modules linked in:
CPU: 0
PC is at ide_drive_remove+0x44/0x64
LR is at ide_drive_remove+0x48/0x64
...
Process cardctl (pid: 773, stack limit = 0xc0d54194)
...
Backtrace:
(ide_drive_remove+0x0/0x64) from (device_release_driver+0x70/0x80)
(device_release_driver+0x0/0x80) from (bus_remove_device+0x58/0x90)
(bus_remove_device+0x0/0x90) from (device_del+0x68/0x9c)

I added a few debug outputs and noticed that the call stack is

IDE: ide_unregister(639)
IDE: ide_unregister_subdriver(2094)
IDE: ide_unregister_subdriver(2096): drive=hda, driver=ide-disk
IDE: auto_remove_settings(1092)
IDE: ide_hwif_release_regions(494)
IDE: ide_drive_remove(2127)
IDE: ide_drive_remove(2133): ERROR: DRIVER(drive)=00000000 !!!

In ide_unregister_subdriver() I found

	drive->driver = NULL;

so of corse if ide_drive_remove() is called later DRIVER(drive) is NULL and 
DRIVER(drive)->cleanup(drive) crashes.

So maybe you want to do a check like

	if (DRIVER(drive))
		DRIVER(drive)->cleanup(drive);

in drivers/ide/ide.c:ide_drive_remove().

Please CC me as I am not subscribe to the list.

-- 
Steven

                 reply	other threads:[~2005-05-19 13:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=428C962A.2000308@imc-berlin.de \
    --to=steven.scholz@imc-berlin.de \
    --cc=linux-ide@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;
as well as URLs for NNTP newsgroup(s).