Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2011276imm; Tue, 10 Jul 2018 11:33:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdRGjz0UB32+Yfs30ddm7NbbdEBVWZ9WkUAXTNSFW6yvVmO/lh4cMR4K+c+Zg+bCpGQR1aJ X-Received: by 2002:a17:902:654b:: with SMTP id d11-v6mr25518216pln.8.1531247613574; Tue, 10 Jul 2018 11:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531247613; cv=none; d=google.com; s=arc-20160816; b=1IQUvqCn0I1ZTo4/Dt+qXjtq6XJTi8PxLTX316NKvjX3zrzMSuPbSNsPjiIzQsCB0B lslTETkBLh2FP9RV1UZrhEIuDO672nsHW87oBOWyCZ4tMAhRrCD1EQXMmbGeaguS4FzB hGOYUm5s0aBnAsZD2ofyEkLQRHilIalzvHPx1vY/5svlmfQJPs0ZWn8oXunOEQSuVpQg Mlmf0STMfzRZM3z7ITMv0uJh1Hw733FB/2ctfxtnAo5wsF3WqgnFgUGLzon9H1PQM9R0 5I2YZHEFA3KcKEKsm8iiiZaprxP0YhApAEyE1eBy0MJvpkizPB2ImE8RM4czrII6VDuv E5pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=0HfGoVssHXzX4E0M2G2WepZiXRtvH72LyUGCwaaEAy8=; b=PI5xoee8eO+1q040ZT5AY3ftucPXlTnX6ayOyquQkJ2sYRJZasVZ1B4ZAf0xb1u91b sNxfpGqygQz7fzBg4T+LnsGTFVsvL7b3iEzn3RiZ0sveEqRZujEc84h7o6BZABMy4ndJ vy2LLBsV5LfXH1HB70SWhnK+5/3K1LwuszRmejfpRnAfwro9XxiUt7ivkQw0/N6CTNfb Eqnwu6/WJmWf70U/foVMoXM0XUtwC93+Fi4Y+JXqAxVsGauYzMv6xewwD1XwHtym7jzR DT9AUzSzNHSzJE2sQdHSTt2MUSop5CA07qWLu+Ryzn6BtUTyuBs97+kmYRYf4ehOexV2 NMrw== ARC-Authentication-Results: i=1; mx.google.com; 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 m73-v6si3623755pga.398.2018.07.10.11.33.18; Tue, 10 Jul 2018 11:33:33 -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; 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 S2388417AbeGJSbj (ORCPT + 99 others); Tue, 10 Jul 2018 14:31:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45872 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387837AbeGJSbi (ORCPT ); Tue, 10 Jul 2018 14:31:38 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 255E4EB4; Tue, 10 Jul 2018 18:31:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Ido Schimmel , Jiri Slaby Subject: [PATCH 4.9 36/52] mlxsw: spectrum: Forbid linking of VLAN devices to devices that have uppers Date: Tue, 10 Jul 2018 20:25:04 +0200 Message-Id: <20180710182452.717134990@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710182449.285532226@linuxfoundation.org> References: <20180710182449.285532226@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ido Schimmel Jiri Slaby noticed that the backport of upstream commit 25cc72a33835 ("mlxsw: spectrum: Forbid linking to devices that have uppers") to kernel 4.9.y introduced the same check twice in the same function instead of in two different places. Fix this by relocating one of the checks to its intended place, thus preventing unsupported configurations as described in the original commit. Fixes: 73ee5a73e75f ("mlxsw: spectrum: Forbid linking to devices that have uppers") Signed-off-by: Ido Schimmel Reported-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -4187,10 +4187,6 @@ static int mlxsw_sp_netdevice_port_upper if (netif_is_lag_port(dev) && is_vlan_dev(upper_dev) && !netif_is_lag_master(vlan_dev_real_dev(upper_dev))) return -EINVAL; - if (!info->linking) - break; - if (netdev_has_any_upper_dev(upper_dev)) - return -EINVAL; break; case NETDEV_CHANGEUPPER: upper_dev = info->upper_dev; @@ -4566,6 +4562,8 @@ static int mlxsw_sp_netdevice_vport_even return -EINVAL; if (!info->linking) break; + if (netdev_has_any_upper_dev(upper_dev)) + return -EINVAL; /* We can't have multiple VLAN interfaces configured on * the same port and being members in the same bridge. */