]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r284348: Fix panic when adding vtnet interfaces to a bridge
authorkp <kp@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 1 Jul 2015 21:21:14 +0000 (21:21 +0000)
committerkp <kp@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 1 Jul 2015 21:21:14 +0000 (21:21 +0000)
commit428e9cdc4bfd4685d2bb1c1e48695c3aa2008232
tree178c1feb7e63e73dbf6ce8d034c211ad111f02f5
parent42598a754170c7f754a0db7cf91ae651655fc466
MFC r284348: Fix panic when adding vtnet interfaces to a bridge

vtnet interfaces are always in promiscuous mode (at least if the
VIRTIO_NET_F_CTRL_RX feature is not negotiated with the host).  if_promisc() on
a vtnet interface returned ENOTSUP although it has IFF_PROMISC set. This
confused the bridge code. Instead we now accept all enable/disable promiscuous
commands (and always keep IFF_PROMISC set).

There are also two issues with the if_bridge error handling.

If if_promisc() fails it uses bridge_delete_member() to clean up. This tries to
disable promiscuous mode on the interface. That runs into an assert, because
promiscuous mode was never set in the first place. (That's the panic reported in
PR 200210.)
We can only unset promiscuous mode if the interface actually is promiscuous.
This goes against the reference counting done by if_promisc(), but only the
first/last if_promic() calls can actually fail, so this is safe.

A second issue is a double free of bif. It's already freed by
bridge_delete_member().

PR:         200210

git-svn-id: svn://svn.freebsd.org/base/stable/10@285016 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/dev/virtio/network/if_vtnet.c
sys/net/if_bridge.c