Commit:     7f988eab57bd22884bbc452fb04c6c18738666b3
Parent:     7ce1b0edcb11f90f6fc5e0ceecff467f329889a0
Author:     Herbert Xu <[EMAIL PROTECTED]>
AuthorDate: Mon Jul 30 16:35:46 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Tue Jul 31 02:28:13 2007 -0700

    [NET]: Take dev_base_lock when moving device name hash list entry
    When we added name-based hashing the dev_base_lock was designated as the
    lock to take when changing the name hash list.  Unfortunately, because
    it was a preexisting lock that just happened to be taken in the right
    spots we neglected to take it in dev_change_name.
    The race can affect calles of __dev_get_by_name that do so without taking
    the RTNL.  They may end up walking down the wrong hash chain and end up
    missing the device that they're looking for.
    Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
 net/core/dev.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 7bfea5e..346cbf6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -839,8 +839,12 @@ int dev_change_name(struct net_device *dev, char *newname)
                strlcpy(dev->name, newname, IFNAMSIZ);
        device_rename(&dev->dev, dev->name);
+       write_lock_bh(&dev_base_lock);
        hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
+       write_unlock_bh(&dev_base_lock);
        raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
        return err;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to