From: Thomas Kleffel <tk@maintech.de>

When a mounted CF-Card is removed from the system, inserted back into the
slot, removed again, and then umount is called for that device the kernel
oopes.

This happens because the reference counting gets confused.  When a disk
gets released by ide_disk_release() it sets the driver_data member of the
corresponding drive to NULL.  This is bad, as the pyhsical drive could be
assigned to another idkp structure in the meantime (happens, when the drive
is removed and inserted again).

My fix is to simply leave the drive alone when a disk is released.  This
shouldn't cause any side-effects - drive->driver_data isn't tested for
containing NULL anywhere.

Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/ide/ide-disk.c |    3 ---
 1 files changed, 3 deletions(-)

diff -puN drivers/ide/ide-disk.c~fix-kernel-oops-with-cf-cards drivers/ide/ide-disk.c
--- 25/drivers/ide/ide-disk.c~fix-kernel-oops-with-cf-cards	Wed Sep  7 15:02:29 2005
+++ 25-akpm/drivers/ide/ide-disk.c	Wed Sep  7 15:02:29 2005
@@ -1048,11 +1048,8 @@ static int ide_disk_remove(struct device
 static void ide_disk_release(struct kref *kref)
 {
 	struct ide_disk_obj *idkp = to_ide_disk(kref);
-	ide_drive_t *drive = idkp->drive;
 	struct gendisk *g = idkp->disk;
 
-	drive->driver_data = NULL;
-	drive->devfs_name[0] = '\0';
 	g->private_data = NULL;
 	put_disk(g);
 	kfree(idkp);
_