I am trying to port a driver for a custom PCI board to a system running
Fedora Core 4 with the kernel 2.6.12-1.1447_FC4smp. The PC is custom
system based on a SuperMicro X5DPE-G2 MB with 2 Intel Xeon processors.
Everytime I try to rmmod the driver, I get a segmentation fault, and the
driver won't unload.
I have now reduced the driver to just the module_init and module_exit
calls, don't try to do anything useful with the PCI board, and still get
this problem. the relevant syslog entries are (prorc is the device I am
trying to port the driver for):

Sep 21 10:38:03 cancer kernel: prorc: RORC device driver version v4.4.3
Sep 21 10:38:03 cancer kernel: prorc: RORC pci card, device count: 0
Sep 21 10:38:19 cancer kernel: prorc: rorc_pci_cleanup
Sep 21 10:38:19 cancer kernel: prorc: rorc_pci_cleanup:
pci_unregister_driver
Sep 21 10:38:19 cancer kernel: Unable to handle kernel paging request at
virtual address f8865026
Sep 21 10:38:19 cancer kernel: printing eip:
Sep 21 10:38:19 cancer kernel: f8865026
Sep 21 10:38:19 cancer kernel: *pde = f7f46b64
Sep 21 10:38:19 cancer kernel: Oops: 0000 [#1]
Sep 21 10:38:19 cancer kernel: SMP
Sep 21 10:38:19 cancer kernel: Modules linked in: rorc_driver(U) nfs
lockd md5 ipv6 parport_pc lp parport autofs4 sunrpc ipt_REJECT ipt_state
ip_conntrack iptable_filter ip_tables dm_mod video button battery ac
uhci_hcd hw_random i2c_i801 i2c_core shpchp e1000 floppy ext3 jbd
Sep 21 10:38:19 cancer kernel: CPU: 2
Sep 21 10:38:19 cancer kernel: EIP: 0060:[] Not tainted VLI
Sep 21 10:38:19 cancer kernel: EFLAGS: 00010282 (2.6.12-1.1447_FC4smp)
Sep 21 10:38:19 cancer kernel: EIP is at 0xf8865026
Sep 21 10:38:19 cancer kernel: eax: f7c53400 ebx: f7c53400 ecx:
f893229c edx: f8865026
Sep 21 10:38:19 cancer kernel: esi: f7c53444 edi: f893224c ebp:
f3034000 esp: f3034f24
Sep 21 10:38:19 cancer kernel: ds: 007b es: 007b ss: 0068
Sep 21 10:38:19 cancer kernel: Process rmmod (pid: 3032,
threadinfo=f3034000 task=c1ea9020)
Sep 21 10:38:19 cancer kernel: Stack: c01ded59 f7c53468 c023f1f1
f893229c f893224c f893224c c023f217 c036ec40
Sep 21 10:38:19 cancer kernel: c036ec94 c023f5f6 f893224c
00000003 bff3d644 c023fa2e f8932220 c01def03
Sep 21 10:38:19 cancer kernel: f8932380 f89314f5 f89316f8
c013a069 63726f72 6972645f 00726576 00000880
Sep 21 10:38:19 cancer kernel: Call Trace:
Sep 21 10:38:19 cancer kernel: [] pci_device_remove+0x16/0x28
Sep 21 10:38:19 cancer kernel: [] device_release_driver+0x45/0x50
Sep 21 10:38:19 cancer kernel: [] driver_detach+0x1b/0x22
Sep 21 10:38:19 cancer kernel: [] bus_remove_driver+0x42/0x77
Sep 21 10:38:19 cancer kernel: [] driver_unregister+0x8/0x13
Sep 21 10:38:19 cancer kernel: [] pci_unregister_driver+0xb/0x13
Sep 21 10:38:19 cancer kernel: [] rorc_pci_cleanup+0x25/0x35
[rorc_driver]
Sep 21 10:38:19 cancer kernel: [] sys_delete_module+0x11a/0x158
Sep 21 10:38:19 cancer kernel: [] do_syscall_trace+0xef/0x123
Sep 21 10:38:19 cancer kernel: [] syscall_call+0x7/0xb
Sep 21 10:38:19 cancer kernel: Code: Bad EIP value.


The relevant code fragments are below. Any ideas on how to debug this
would be very much appreciated.

Dr Joachim Schambach
The University of Texas at Austin
Department of Physics
1 University Station C1600
Austin, Texas 78712-0264, USA
Phone: (512) 471-1303; FAX: (814) 295-5111
e-mail: jschamba@physics.utexas.edu

------ code fragment ----------------
MODULE_DESCRIPTION("RORC DRIVER");
MODULE_LICENSE("GPL");


/* CERN vendor/id */
#define RORC2_VENDOR 0x10dc
#define RORC2_ID 0x0033

#define DEVICE_MAJOR 125
#define DEVICE_NAME "prorc"

static struct pci_device_id rorc_pci_tbl[] = {
{ PCI_DEVICE(RORC2_VENDOR, RORC2_ID), },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, rorc_pci_tbl);

/* Method prototypes */
int rorc_init_one(struct pci_dev *dev, const struct pci_device_id *ent);
void rorc_remove_one(struct pci_dev *dev);

static struct pci_driver rorc_driver = {
.name = DEVICE_NAME,
.id_table = rorc_pci_tbl,
.probe = rorc_init_one,
.remove = rorc_remove_one,
};


static rorc_t prorc[MAX_DEVICE];
static int device_count;

/********************************************/
int __init rorc_init_one(struct pci_dev *dev, const struct pci_device_id
*ent)
{
int err,i;

printk("<1>"DEVICE_NAME": RORC pci card, device count: %d\n",
device_count);

i = pci_enable_device (dev);
if (i)
return i;

return 0;
}

/********************************************/
void __init rorc_remove_one(struct pci_dev *dev)
{
printk("<1>"DEVICE_NAME": Bye ...\n");
}


/********************************************/
static int __init rorc_pci_init(void)
{
printk(DEVICE_NAME": RORC device driver version %s\n",
RORC_DRIVER_VERSION);


device_count = 0;
return pci_register_driver (&rorc_driver);
}


/********************************************/
static void __exit rorc_pci_cleanup(void)
{
printk(KERN_INFO DEVICE_NAME": rorc_pci_cleanup\n");
printk(KERN_INFO DEVICE_NAME": rorc_pci_cleanup:
pci_unregister_driver\n");
pci_unregister_driver (&rorc_driver);
printk(KERN_INFO DEVICE_NAME": rorc_pci_cleanup finished\n");

}

/********************************************/
module_init(rorc_pci_init);
/********************************************/
module_exit(rorc_pci_cleanup);
/*****************************/
--
Dr Joachim Schambach
The University of Texas at Austin
Department of Physics
1 University Station C1600
Austin, Texas 78712-0264, USA
Phone: (512) 471-1303; FAX: (814) 295-5111
e-mail: jschamba@physics.utexas.edu