From patchwork Tue Feb 14 21:20:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Figg X-Patchwork-Id: 141202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 21B73B6FD8 for ; Wed, 15 Feb 2012 08:20:27 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RxPnQ-00066L-Lz; Tue, 14 Feb 2012 21:20:20 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RxPnO-00064f-DA for kernel-team@lists.ubuntu.com; Tue, 14 Feb 2012 21:20:18 +0000 Received: from static-50-53-107-235.bvtn.or.frontiernet.net ([50.53.107.235] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1RxPnO-0007tv-1Y for kernel-team@lists.ubuntu.com; Tue, 14 Feb 2012 21:20:18 +0000 From: Brad Figg To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/3] be2net: non-member vlan pkts not received in promiscous mode Date: Tue, 14 Feb 2012 13:20:07 -0800 Message-Id: <1329254408-22456-3-git-send-email-brad.figg@canonical.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1329254408-22456-1-git-send-email-brad.figg@canonical.com> References: <1329254408-22456-1-git-send-email-brad.figg@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Sathya Perla CVE-CVE-2011-3347 BugLink: http://bugs.launchpad.net/bugs/880893 While configuring promiscous mode, explicitly set the VLAN_PROMISCOUS bit to make this happen. When switching off promiscous mode, re-program the vids. Signed-off-by: Xavier Selvin Signed-off-by: Sathya Perla Signed-off-by: David S. Miller (cherry picked from commit c0e64ef4899df4cedc872871e54e2c069d29e519) Signed-off-by: Brad Figg --- drivers/net/benet/be_cmds.c | 6 ++++-- drivers/net/benet/be_main.c | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 81654ae..5e5c62e 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -1506,9 +1506,11 @@ int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en) OPCODE_COMMON_NTWK_RX_FILTER, sizeof(*req)); req->if_id = cpu_to_le32(adapter->if_handle); - req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS); + req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS + | BE_IF_FLAGS_VLAN_PROMISCUOUS); if (en) - req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS); + req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS + | BE_IF_FLAGS_VLAN_PROMISCUOUS); sge->pa_hi = cpu_to_le32(upper_32_bits(promiscous_cmd.dma)); sge->pa_lo = cpu_to_le32(promiscous_cmd.dma & 0xFFFFFFFF); diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 146e420..bf8d198 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c @@ -824,6 +824,10 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num) status = be_cmd_vlan_config(adapter, if_handle, vtag, 1, 1, 0); } + /* No need to further configure vids if in promiscuous mode */ + if (adapter->promiscuous) + return 0; + if (adapter->vlans_added <= adapter->max_vlans) { /* Construct VLAN Table to give to HW */ for (i = 0; i < VLAN_N_VID; i++) { @@ -883,6 +887,9 @@ static void be_set_multicast_list(struct net_device *netdev) if (adapter->promiscuous) { adapter->promiscuous = false; be_cmd_promiscuous_config(adapter, false); + + if (adapter->vlans_added) + be_vid_config(adapter, false, 0); } /* Enable multicast promisc if num configured exceeds what we support */