All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Korotaev <dev@sw.ru>
To: linux-kernel@vger.kernel.org
Subject: Ugly netdev sysfs errors handling
Date: Sat, 02 Oct 2004 17:42:23 +0400	[thread overview]
Message-ID: <415EB03F.2020500@sw.ru> (raw)

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



                 reply	other threads:[~2004-10-02 13:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=415EB03F.2020500@sw.ru \
    --to=dev@sw.ru \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.