From owner-freebsd-net@freebsd.org Wed Jul 1 16:12:23 2015 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 279E19920DE for ; Wed, 1 Jul 2015 16:12:23 +0000 (UTC) (envelope-from nvass@gmx.com) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A85C415B0; Wed, 1 Jul 2015 16:12:22 +0000 (UTC) (envelope-from nvass@gmx.com) Received: from moby.local ([37.6.23.86]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0M3S2C-1YswIF16FE-00qyKv; Wed, 01 Jul 2015 18:12:19 +0200 Message-ID: <55941147.7040601@gmx.com> Date: Wed, 01 Jul 2015 19:11:51 +0300 From: Nikos Vassiliadis User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: bugzilla-noreply@freebsd.org, freebsd-net@FreeBSD.org CC: Kristof Provost Subject: Re: [Bug 200210] adding vtnet to bridge results to kernel panic References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:fNTS6fvUTwn3UwjhLJY2KwYS3hVD1+C/+hoUNXWXE/4XKQsbbcp zZIEv1L9Qwo/63I0iLE6PiH1fLcewY3vbUPEkJjuNSM85iz6Dj4u4T1AkyzC1J8WmjXtJV8 zcR+1ZhWyoCAO/JWZ0vIooV+Cm+YzS8WP6z3yRAdMQsp7cfh2eTdRFr+52j/qKJAe4Eor5L iMEHne7TSkG6cyrkAl7Mw== X-UI-Out-Filterresults: notjunk:1;V01:K0:1agM+IgU804=:PqTRxKA6jb2RKYlu+CDCSL QePa7aPts61QLmncx9Hxb1BlKWApb8F/sc+4ql7/vFTFPb7vvZK8Nl8QU47Fs+r3pqkfcujL8 d/hir3+l1pAgU8yvr1Oom8vXuVw2+uN7KwdUsQfTbqpdU98rlMXAK48GlDhvbEA3E2e2NxIfV sUOtTEBPe5HcE2woFkyW/s3LxkwFUZBXGaTDhEkJvWEAZym5pyOn+R0Th5dMYR4UG+JRsXvgS 8JSppyYCtaZQ1KV/7hG7fImLjgU6yJ4DgX+K55BsOTpM1HIsGA29QDr1byCWWgI3ZKU1SuvDY BIC82b6e00VUU8FgJHRLpA/deYw/POKVRKBZcFB1Fsoujbmk1Jt9uih7lZgz0qCjgNy6lMIC2 48wrKtcGXNHvb7PdM2uXL4GBgVWYyn+iDBDPN9kiRtOZg6Wwu41/Zn3iYNgSDUFQBitWXcFcb 9EqqxKqDbHlkjNRgcchWO1b2w1RtOqhQMLhx2KIjamZTOvwqvaKhub1sSlGsHWVSFHYVxLPf8 KtFcjOJAmJTs0Ubxxz0Fc+ULPIEHM6zpbrEFgx2/VRrdsAlZvZshHhkdMg1FB7K0V8ziie2Yb A2ezmcOUjMhYBdoe9rpCN7k2Gro/UJ8wC0XBYaJlW2Cew7PnqsV8pkBvmIbhbCQFe6WZM5QjI gBMSIVNdQAFzuN1X957dNcFsov9FB/ffAeIMATrugA4y3xbRyB4joLa7Bikx0KecxCYU= X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2015 16:12:23 -0000 Hi Kristof, Thanks for fixing this! Could you MFC the fix? On 06/13/15 22:39, bugzilla-noreply@freebsd.org wrote: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200210 > > --- Comment #1 from commit-hook@freebsd.org --- > A commit references this bug: > > Author: kp > Date: Sat Jun 13 19:39:22 UTC 2015 > New revision: 284348 > URL: https://svnweb.freebsd.org/changeset/base/284348 > > Log: > 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 > Differential Revision: https://reviews.freebsd.org/D2804 > Reviewed by: philip (mentor) > > Changes: > head/sys/dev/virtio/network/if_vtnet.c > head/sys/net/if_bridge.c >