All of lore.kernel.org
 help / color / mirror / Atom feed
From: "wanghai (M)" <wanghai26@huawei.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	syzbot <syzbot+6024817a931b2830bc93@syzkaller.appspotmail.com>
Cc: <alexander.h.duyck@intel.com>, <amritha.nambiar@intel.com>,
	<davem@davemloft.net>, <dmitry.torokhov@gmail.com>,
	<f.fainelli@gmail.com>, <idosch@mellanox.com>, <joe@perches.com>,
	<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<stephen@networkplumber.org>, <syzkaller-bugs@googlegroups.com>,
	<tyhicks@canonical.com>, <yuehaibing@huawei.com>
Subject: Re: kernel BUG at net/core/net-sysfs.c:LINE!
Date: Mon, 25 Mar 2019 23:20:01 +0800	[thread overview]
Message-ID: <280fdb18-4948-968d-faa6-23197cd2b23e@huawei.com> (raw)
In-Reply-To: <20190323171621.GF9224@smile.fi.intel.com>

thanks , Can it be fixed like this?

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 4ff661f..e609c8d 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1745,16 +1745,21 @@ int netdev_register_kobject(struct net_device *ndev)

         error = device_add(dev);
         if (error)
-               return error;
+               goto error_put_device;

         error = register_queue_kobjects(ndev);
-       if (error) {
-               device_del(dev);
-               return error;
-       }
+       if (error)
+               goto error_device_del;

         pm_runtime_set_memalloc_noio(dev, true);

+       return 0;
+
+error_device_del:
+       device_del(dev);
+error_put_device:
+       ndev->reg_state = NETREG_RELEASED;
+       put_device(dev);
         return error;
  }

在 2019/3/24 1:16, Andy Shevchenko 写道:
> Nice.
>
> I looked briefly in the flow of this report and it looks like the patch above
> should be reverted.
>
> The problem is not so easy to fix. One approach is to initialize device
> (and thus kobject) somewhere in alloc_netdev() and put device in free_netdev()
> respectively, but this might produce more interesting regressions.


  reply	other threads:[~2019-03-25 15:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-23  7:32 kernel BUG at net/core/net-sysfs.c:LINE! syzbot
2019-03-23 17:16 ` Andy Shevchenko
2019-03-25 15:20   ` wanghai (M) [this message]
2019-03-25 16:10     ` Andy Shevchenko
2019-03-25 18:55       ` Dmitry Torokhov
2019-03-25 19:18         ` Dmitry Torokhov
2019-04-04  3:19 ` wanghai (M)
2019-04-04  3:53   ` Eric Dumazet
2019-04-05  2:55   ` Al Viro

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=280fdb18-4948-968d-faa6-23197cd2b23e@huawei.com \
    --to=wanghai26@huawei.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=amritha.nambiar@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@mellanox.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=syzbot+6024817a931b2830bc93@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tyhicks@canonical.com \
    --cc=yuehaibing@huawei.com \
    /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.