public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Ugly netdev sysfs errors handling
@ 2004-10-02 13:42 Kirill Korotaev
  0 siblings, 0 replies; only message in thread
From: Kirill Korotaev @ 2004-10-02 13:42 UTC (permalink / raw)
  To: linux-kernel

Hello,

During debug I faced oops in 
netdev_unregister_sysfs()->sysfs_remove_group(),
since kobj->dentry == NULL.

The problem is that netdev code doesn't handle errors from sysfs 
correctly - it calls netdev_unregister_sysfs() in any case, even if 
netdev_register_sysfs() failed on registering:

void netdev_run_todo(void)
...
                 case NETREG_REGISTERING:
                         err = netdev_register_sysfs(dev);
                         if (err)
                                 printk(KERN_ERR "%s: failed sysfs 
registration (%d)\n",
                                        dev->name, err);
                         dev->reg_state = NETREG_REGISTERED;
                         break;
                 case NETREG_UNREGISTERING:
                         netdev_unregister_sysfs(dev); <<<< OOPS here,
					<<<< if netdev_register_sysfs()
					<<<<< failed
...

I tried to fix it in netdev code, but it's impossible to do it in a 
fashioned manner. Since there are some kobject manipulations in 
destructors (e.g. free_netdev() oopses as well if workaround the above 
code).
Another approach can be to check kobj->dentry and other fields in sysfs.

Maybe someone has any ideas on this? Except for "no errors should 
normally happen" :)

Kirill



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-02 13:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-02 13:42 Ugly netdev sysfs errors handling Kirill Korotaev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox