提交 30df94f8 编写于 作者: J Jeff Hansen 提交者: David S. Miller

bridge: Fix double-free in br_add_if.

There is a potential double-kfree in net/bridge/br_if.c.  If br_fdb_insert
fails, then the kobject is put back (which calls kfree due to the kobject
release), and then kfree is called again on the net_bridge_port.  This
patch fixes the crash.

Thanks to Stephen Hemminger for the one-line fix.
Signed-off-by: NJeff Hansen <x@jeffhansen.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8823ad31
......@@ -432,6 +432,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
br_fdb_delete_by_port(br, p, 1);
err1:
kobject_put(&p->kobj);
p = NULL; /* kobject_put frees */
err0:
dev_set_promiscuity(dev, -1);
put_back:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册