Panic while calling unregister_netdev()

sroy@wipinfo.soft.net
Tue, 29 Sep 1998 15:23:06 -0400 (EDT)


Hi,

I'm writing a network driver on Redhat 5.1 Linux for a satellite receiver
card (it has another ethernet card from DEC). [Unloading the driver for the
ethernet card does not aolve the problem]

While calling unregister_netdev() from the cleanup_module(), it panics saying
"kfree of non-kmalloced memory: 000054e4, next = 00000000, order=5".

I'm very much surprised how it fails with this minimum code. Do I need any
patch to apply ?

Any help is appreciated.

- Somnath.

I've written just a skeleton driver with the psudo code as follows.

init_module()
{
- count no. of adapters (there is only 1 satellite receiver card, so
it returns 1)

- for all such (presently 1) adapters

- use kmalloc to allocate memory for struct device and dev->name

- initialize dev->name so that the first byte it points to is 0.

- set _init() entry point

- call register_netdev(dev)

- store dev globally in g_dev_ptr
(as there is only 1, just for debugging)

}

where the _init() entry point does the following -

- initialize _opne(), _stop(), _hard_start_xmit() entry point

- call ether_setup()

- change dev->tx_queue_len to 0

The cleanup_module() looks like -

cleanup_module()
{
- take dev from the global variable g_dev_ptr

- call unregister_netdev(dev) /*** Here it panics ***/

- kfree(dev)
}

/~~~|~~~~|~~~~|~~~~|~~~~|~~~~|~~~~|~~~~|~~~~|~~~~|~~~~~/~~~|~\
|____|____|____|____|____|____|____|____|____|____|____/ |) \
| Somnath Roy, Wipro Ltd., E-ml:sroy@wipinfo.soft.net /_____|___\
/DivyaSree,30,Mission Rd.,Bl-27, Ph-2241730 (Ext-3305)///////| |
| |///////| |
| Journey of thousand miles begins with a single step |///////| |
~~~/~~~\~/~~~\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/~~~\~~~~
\___/ \___/ \___/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/