Re: Bug in BCMA: device_unregister causing "NULL pointer dereferenceat"

From: Pavel Roskin
Date: Thu Jul 21 2011 - 12:33:51 EST

On 07/21/2011 03:18 AM, RafaÅ MiÅecki wrote:

So when I unload bcma after I got driver (b43) for 0x812 core, I get
NULL pointer dereference.

Any tip, why does it happen?

I've tracked where does crash really happen (kobject_del does not
really say much). The real forwardtrace is:
device_unregister â device_del â kobject_del â kobj_kset_leave â
kobj_kset_leave â list_del_init

If you take a look at list_del_init, it touches "prev" and "next". So
I've added some debugging:
pr_info("core->dev.kobj.entry.prev: 0x%p\n", core->dev.kobj.entry.prev);
pr_info("core-> 0x%p\n", core->;

There are options for debugging that you may want to enable:


Actually, consider enabling most debug options as possible, except perhaps the most time consuming (such as CONFIG_DEBUG_KMEMLEAK). Maybe you are passing a freed pointer or something.

Print the pointers you are passing to device_register() and device_unregister().

[ 612.819320] bcma: core->dev.kobj.entry.prev: 0x (null)

You may want to make it a macro and print it in most bcma functions.

Pavel Roskin
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at