提交 43af8532 编写于 作者: V Volodymyr G Lukiianyk 提交者: David S. Miller

bridge: fix error handling in br_add_if()

When device is added to bridge its refcnt is incremented (in new_nbp()), but if
error occurs during further br_add_if() operations this counter is not
decremented back. Fix it by adding dev_put() call in the error path.
Signed-off-by: NVolodymyr G Lukiianyk <volodymyrgl@gmail.com>
Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9a732ed6
......@@ -411,9 +411,12 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
br_fdb_delete_by_port(br, p, 1);
err1:
kobject_del(&p->kobj);
return err;
goto put_back;
err0:
kobject_put(&p->kobj);
put_back:
dev_put(dev);
return err;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册