Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808587/?format=api
{ "id": 808587, "url": "http://patchwork.ozlabs.org/api/patches/808587/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170901085231.1396-1-jiri@resnulli.us/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170901085231.1396-1-jiri@resnulli.us>", "list_archive_url": null, "date": "2017-09-01T08:52:31", "name": "[net] mlxsw: spectrum: Forbid linking to devices that have uppers", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "5504aabff1dba86a9d673bcc0b0518b00b3f4060", "submitter": { "id": 15321, "url": "http://patchwork.ozlabs.org/api/people/15321/?format=api", "name": "Jiri Pirko", "email": "jiri@resnulli.us" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170901085231.1396-1-jiri@resnulli.us/mbox/", "series": [ { "id": 975, "url": "http://patchwork.ozlabs.org/api/series/975/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=975", "date": "2017-09-01T08:52:31", "name": "[net] mlxsw: spectrum: Forbid linking to devices that have uppers", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/975/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808587/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808587/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=resnulli-us.20150623.gappssmtp.com\n\theader.i=@resnulli-us.20150623.gappssmtp.com\n\theader.b=\"OgK8BKCO\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkCgG4ChVz9t2c\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 1 Sep 2017 18:52:42 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751713AbdIAIwj (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 1 Sep 2017 04:52:39 -0400", "from mail-wr0-f196.google.com ([209.85.128.196]:36007 \"EHLO\n\tmail-wr0-f196.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751553AbdIAIwf (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 1 Sep 2017 04:52:35 -0400", "by mail-wr0-f196.google.com with SMTP id 40so973469wrv.3\n\tfor <netdev@vger.kernel.org>; Fri, 01 Sep 2017 01:52:34 -0700 (PDT)", "from localhost (jirka.pirko.cz. [84.16.102.26])\n\tby smtp.gmail.com with ESMTPSA id\n\t33sm1310192wra.6.2017.09.01.01.52.32\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 01 Sep 2017 01:52:32 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=resnulli-us.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id;\n\tbh=yqJoL/n59IzMCESXOW5gWGXFXddrVByKu1XyQUuIONA=;\n\tb=OgK8BKCORbyBzw+Z99HUDpyGmwq2VCBMRE4bZyid+L/y9YlNHrjsIft/CIbYuDj91G\n\tB5302ClpyIDWOAgPaas0WO2G/IhrmEgE1jYF9RirIQ4OAD5sUaeHI/0oPT/5FecI9yJW\n\tRvSYdUi2g0cuZWkaWeNSJobRFgsl4SUZvEdW+a4Z/2sMsotafc6gnsm4WwFnPhZDtgJy\n\t50JTm8QFpR/aIk9GhSK4Yi1AQ2robHaT6i/2PSCEfAMJMx5dQG5mPyTnX9JZZ2H+Hqlw\n\t6MveSvyDhPbAcyYWCJOJjog4bpNBHvTfflzvZtQxcGNjX+Q5FiXqnMrMixtyRJ9DFXKp\n\tBjQw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=yqJoL/n59IzMCESXOW5gWGXFXddrVByKu1XyQUuIONA=;\n\tb=EIj/9YXQqy+OM4qRMY9/B0Vm/CncNf9jr8nywq8kYeVHLphhPAtEnB119iVVWyK3Fk\n\t/vbMZU4baNU2uqEcm8mlgXmFiAADJ2/sdeEHDFmShZ1OPzrHJGnD/YSwn+FaPE2ljMRV\n\ttVac6uY9CeRxgkjgPVLctLxNbcN/V0uIHGXDrGk46chFahGzbM5grrQIwfq71cZfcdyq\n\t0dzL6nRptvGdKFvRUaAuzcXWy0KfAvcCzQCL9liAfneBOrQJ8+s/FrwNT8hpfkilmPE/\n\tQ5kKGLIgcVjIiKypJCnCyvL7kn3vni+XPHxIs9KNUyalx9lQ051Mq9AibVy7n5ALVNaR\n\tG4Yw==", "X-Gm-Message-State": "AHPjjUijP75dvCrrarNRkdktbJJkAYGMcYMBs6tS3k56svMvaOMF/qke\n\tq8L3pfJ/tSEUg4r7xFI=", "X-Google-Smtp-Source": "ADKCNb7IbulU9B+6/xkAozmQjYAdcckClYO/HiajLX0qf7fWabNREiw+pLRox96irXaPw5/RwfA1MQ==", "X-Received": "by 10.223.130.229 with SMTP id 92mr708487wrc.78.1504255953608;\n\tFri, 01 Sep 2017 01:52:33 -0700 (PDT)", "From": "Jiri Pirko <jiri@resnulli.us>", "To": "netdev@vger.kernel.org", "Cc": "davem@davemloft.net, idosch@mellanox.com, nogahf@mellanox.com,\n\tmlxsw@mellanox.com", "Subject": "[patch net] mlxsw: spectrum: Forbid linking to devices that have\n\tuppers", "Date": "Fri, 1 Sep 2017 10:52:31 +0200", "Message-Id": "<20170901085231.1396-1-jiri@resnulli.us>", "X-Mailer": "git-send-email 2.9.3", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Ido Schimmel <idosch@mellanox.com>\n\nThe mlxsw driver relies on NETDEV_CHANGEUPPER events to configure the\ndevice in case a port is enslaved to a master netdev such as bridge or\nbond.\n\nSince the driver ignores events unrelated to its ports and their\nuppers, it's possible to engineer situations in which the device's data\npath differs from the kernel's.\n\nOne example to such a situation is when a port is enslaved to a bond\nthat is already enslaved to a bridge. When the bond was enslaved the\ndriver ignored the event - as the bond wasn't one of its uppers - and\ntherefore a bridge port instance isn't created in the device.\n\nUntil such configurations are supported forbid them by checking that the\nupper device doesn't have uppers of its own.\n\nFixes: 0d65fc13042f (\"mlxsw: spectrum: Implement LAG port join/leave\")\nSigned-off-by: Ido Schimmel <idosch@mellanox.com>\nReported-by: Nogah Frankel <nogahf@mellanox.com>\nTested-by: Nogah Frankel <nogahf@mellanox.com>\nSigned-off-by: Jiri Pirko <jiri@mellanox.com>\n---\n drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 6 ++++++\n include/linux/netdevice.h | 2 ++\n net/core/dev.c | 3 ++-\n 3 files changed, 10 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c\nindex 60bf8f2..c6a3e61b 100644\n--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c\n+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c\n@@ -4139,6 +4139,8 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev,\n \t\t\treturn -EINVAL;\n \t\tif (!info->linking)\n \t\t\tbreak;\n+\t\tif (netdev_has_any_upper_dev(upper_dev))\n+\t\t\treturn -EINVAL;\n \t\tif (netif_is_lag_master(upper_dev) &&\n \t\t !mlxsw_sp_master_lag_check(mlxsw_sp, upper_dev,\n \t\t\t\t\t info->upper_info))\n@@ -4258,6 +4260,10 @@ static int mlxsw_sp_netdevice_port_vlan_event(struct net_device *vlan_dev,\n \t\tupper_dev = info->upper_dev;\n \t\tif (!netif_is_bridge_master(upper_dev))\n \t\t\treturn -EINVAL;\n+\t\tif (!info->linking)\n+\t\t\tbreak;\n+\t\tif (netdev_has_any_upper_dev(upper_dev))\n+\t\t\treturn -EINVAL;\n \t\tbreak;\n \tcase NETDEV_CHANGEUPPER:\n \t\tupper_dev = info->upper_dev;\ndiff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex 779b235..c99ba79 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -3866,6 +3866,8 @@ int netdev_walk_all_upper_dev_rcu(struct net_device *dev,\n bool netdev_has_upper_dev_all_rcu(struct net_device *dev,\n \t\t\t\t struct net_device *upper_dev);\n \n+bool netdev_has_any_upper_dev(struct net_device *dev);\n+\n void *netdev_lower_get_next_private(struct net_device *dev,\n \t\t\t\t struct list_head **iter);\n void *netdev_lower_get_next_private_rcu(struct net_device *dev,\ndiff --git a/net/core/dev.c b/net/core/dev.c\nindex 818dfa6..86b4b0a 100644\n--- a/net/core/dev.c\n+++ b/net/core/dev.c\n@@ -5668,12 +5668,13 @@ EXPORT_SYMBOL(netdev_has_upper_dev_all_rcu);\n * Find out if a device is linked to an upper device and return true in case\n * it is. The caller must hold the RTNL lock.\n */\n-static bool netdev_has_any_upper_dev(struct net_device *dev)\n+bool netdev_has_any_upper_dev(struct net_device *dev)\n {\n \tASSERT_RTNL();\n \n \treturn !list_empty(&dev->adj_list.upper);\n }\n+EXPORT_SYMBOL(netdev_has_any_upper_dev);\n \n /**\n * netdev_master_upper_dev_get - Get master upper device\n", "prefixes": [ "net" ] }