Skip to content

Commit

Permalink
bridge: avoid br_ifinfo_notify when nothing changed
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
honkiko authored and davem330 committed Mar 24, 2013
1 parent 5e95329 commit 7b99a99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/bridge/br_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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) {
Expand Down

0 comments on commit 7b99a99

Please sign in to comment.