]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
bridge: avoid br_ifinfo_notify when nothing changed
authorHong zhi guo <honkiko@gmail.com>
Sun, 24 Mar 2013 03:26:47 +0000 (03:26 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 24 Mar 2013 21:16:30 +0000 (17:16 -0400)
When neither IFF_BRIDGE nor IFF_BRIDGE_PORT is set,
and afspec == NULL but  protinfo != NULL, we run into
"if (err == 0) br_ifinfo_notify(RTM_NEWLINK, p);" with
random value in ret.

Thanks to Sergei for pointing out the error in commit comments.

Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_netlink.c

index 84c3b7d6d1b159d7eb0f22581bae228d236c9c7c..b96e02e31bad9a95d8c57557760279faec2acbb1 100644 (file)
@@ -357,7 +357,7 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh)
        struct nlattr *afspec;
        struct net_bridge_port *p;
        struct nlattr *tb[IFLA_BRPORT_MAX + 1];
-       int err;
+       int err = 0;
 
        ifm = nlmsg_data(nlh);
 
@@ -370,7 +370,7 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh)
        /* We want to accept dev as bridge itself if the AF_SPEC
         * is set to see if someone is setting vlan info on the brigde
         */
-       if (!p && ((dev->priv_flags & IFF_EBRIDGE) && !afspec))
+       if (!p && !afspec)
                return -EINVAL;
 
        if (p && protinfo) {