net: correct error path in rtnl_newlink()
authorCong Wang <cwang@twopensource.com>
Tue, 11 Feb 2014 23:51:30 +0000 (15:51 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Feb 2014 22:08:29 +0000 (17:08 -0500)
commit0e0eee2465df77bcec2e8ff75432b8e57897b143
tree8d0728743356a1f524b6f88f09a1b09016d56190
parentda37705cef30841616ed644ff33455bbc7374db0
net: correct error path in rtnl_newlink()

I saw the following BUG when ->newlink() fails in rtnl_newlink():

[   40.240058] kernel BUG at net/core/dev.c:6438!

this is due to free_netdev() is not supposed to be called before
netdev is completely unregistered, therefore it is not correct
to call free_netdev() here, at least for ops->newlink!=NULL case,
many drivers call it in ->destructor so that rtnl_unlock() will
take care of it, we probably don't need to do anything here.

Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c