Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7232250ybh; Thu, 8 Aug 2019 12:12:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBTSlJr9dq3ZAPOXowLw01CJtPOOFRUmpNlImtsiDgdlBZBqD9GppQVNHZcXj/UtLlc0h8 X-Received: by 2002:a17:90a:b28d:: with SMTP id c13mr406314pjr.25.1565291577658; Thu, 08 Aug 2019 12:12:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565291577; cv=none; d=google.com; s=arc-20160816; b=ZpF3bz4akz51Y6U4Jhb5knwhNi3wWakatHJwHqP5AuCabrNNXhTIr+EY4MjwHhxcu+ wWE6BoI4k859LPAeuWh0txlSPXzkyK5a6PEX+rVSKAntl1Oa7Wq9KuSA8AdQ5unjAbiR lDbvPI+V4fTkTz8hVyvlQF8m6n04MFOtckdFupSJVINp/JssrMi27uPlrPx13t+AFJvO f55i8kErKTo/y5GDdvR6az2LeR/lGhRnRF3QjgjiHUGRqjNo7FFSrU1mloh48CeuhYU0 vOP2+K9i2pN4BWnQxMhtWMNMaJohnWHfysOlltT+rRh4wHPZ3vFo15WGdiKHvfNwP4ab 1XlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yd+6ZJ/PVNLft54IOtjhhW4CHSqO2brUU80gKS5pInw=; b=LfO92+VrARPA3Fengbr7qbmCpOyS0Kr2RtT3YmyF6OALzc1f2d6AEkbJY2WI8UfLJE KtsndT/AxSn01+Pd7PnZwdyvIZLLJ4G49C4/FKxWUpmGV6bZ571jST40Tsu9q033AMFc wGV4WCl4DT4iZTYFwQBBXy0XMopdNns+lhmcoogJ50T3q+vKB8PNhRD0K/D02zqdeCJO sNeQKgCShSjdxlCOu1zUu6KS3Ti1URK/oGHWSLqUXO37NMdV6IZyxEr8Ctb4bhl4Lztk CB24jH7eaTvkF0dUtLU+7KemwQP2jGk7V+8uhDrNJnnsYhlgpX3r2vYBF/uQa0+kc/AT XtyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="F04/DDZ6"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p125si52427136pfp.35.2019.08.08.12.12.42; Thu, 08 Aug 2019 12:12:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="F04/DDZ6"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405250AbfHHTKO (ORCPT + 99 others); Thu, 8 Aug 2019 15:10:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:44484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405220AbfHHTKJ (ORCPT ); Thu, 8 Aug 2019 15:10:09 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 43C16214C6; Thu, 8 Aug 2019 19:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565291408; bh=LmtL5qR0oLp78hjieMs77g1Khs8xZI9OJFts0F10zPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F04/DDZ6LjY8bGdBzlM1UqypCbwU9NmdXnU7JIRaCfZBzFIfe4fY93UsegqC7PyFM GWFzKaR70s5/rmaeXb6ZAJv4ymUWDdTArzSTcXnUQmySsibBxjzYNE4nebhf+s9oxE +I8GV01R948GtxQMFS2u2UBfv5OI4w/sCb/r0Eno= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+88533dc8b582309bf3ee@syzkaller.appspotmail.com, Nikolay Aleksandrov , "David S. Miller" Subject: [PATCH 4.19 21/45] net: bridge: delete local fdb on device init failure Date: Thu, 8 Aug 2019 21:05:07 +0200 Message-Id: <20190808190454.919268976@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190808190453.827571908@linuxfoundation.org> References: <20190808190453.827571908@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nikolay Aleksandrov [ Upstream commit d7bae09fa008c6c9a489580db0a5a12063b97f97 ] On initialization failure we have to delete the local fdb which was inserted due to the default pvid creation. This problem has been present since the inception of default_pvid. Note that currently there are 2 cases: 1) in br_dev_init() when br_multicast_init() fails 2) if register_netdevice() fails after calling ndo_init() This patch takes care of both since br_vlan_flush() is called on both occasions. Also the new fdb delete would be a no-op on normal bridge device destruction since the local fdb would've been already flushed by br_dev_delete(). This is not an issue for ports since nbp_vlan_init() is called last when adding a port thus nothing can fail after it. Reported-by: syzbot+88533dc8b582309bf3ee@syzkaller.appspotmail.com Fixes: 5be5a2df40f0 ("bridge: Add filtering support for default_pvid") Signed-off-by: Nikolay Aleksandrov Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/bridge/br_vlan.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -677,6 +677,11 @@ void br_vlan_flush(struct net_bridge *br ASSERT_RTNL(); + /* delete auto-added default pvid local fdb before flushing vlans + * otherwise it will be leaked on bridge device init failure + */ + br_fdb_delete_by_port(br, NULL, 0, 1); + vg = br_vlan_group(br); __vlan_flush(vg); RCU_INIT_POINTER(br->vlgrp, NULL);