All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Wiedmann <jwi@linux.vnet.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-s390@vger.kernel.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Stefan Raspl <raspl@linux.vnet.ibm.com>,
	Ursula Braun <ubraun@linux.vnet.ibm.com>,
	Julian Wiedmann <jwi@linux.vnet.ibm.com>
Subject: [PATCH net-next 07/13] s390/qeth: don't verify device when setting MAC address
Date: Wed, 18 Oct 2017 17:40:19 +0200	[thread overview]
Message-ID: <20171018154025.73630-8-jwi@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171018154025.73630-1-jwi@linux.vnet.ibm.com>

There's no reason why l2_set_mac_address() should ever be called for
a netdevice that's not owned by qeth. It's certainly not required for
VLAN devices, which have their own netdev_ops.

Also:
1) we don't do such validation for any of the other netdev_ops routines.
2) the code in question clearly has never been actually exercised;
   it's broken. After determining that the device is not owned
   by qeth, it would still use dev->ml_priv to write a qeth trace entry.

Remove the check, and its helper that walked the global card list.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_l2_main.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 7b61c2ef4c74..87aa8c2ab5b0 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -38,24 +38,6 @@ static void qeth_l2_vnicc_init(struct qeth_card *card);
 static bool qeth_l2_vnicc_recover_timeout(struct qeth_card *card, u32 vnicc,
 					  u32 *timeout);
 
-static int qeth_l2_verify_dev(struct net_device *dev)
-{
-	struct qeth_card *card;
-	unsigned long flags;
-	int rc = 0;
-
-	read_lock_irqsave(&qeth_core_card_list.rwlock, flags);
-	list_for_each_entry(card, &qeth_core_card_list.list, list) {
-		if (card->dev == dev) {
-			rc = QETH_REAL_CARD;
-			break;
-		}
-	}
-	read_unlock_irqrestore(&qeth_core_card_list.rwlock, flags);
-
-	return rc;
-}
-
 static struct net_device *qeth_l2_netdev_by_devno(unsigned char *read_dev_no)
 {
 	struct qeth_card *card;
@@ -568,11 +550,6 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p)
 
 	QETH_CARD_TEXT(card, 3, "setmac");
 
-	if (qeth_l2_verify_dev(dev) != QETH_REAL_CARD) {
-		QETH_CARD_TEXT(card, 3, "setmcINV");
-		return -EOPNOTSUPP;
-	}
-
 	if (card->info.type == QETH_CARD_TYPE_OSN ||
 	    card->info.type == QETH_CARD_TYPE_OSM ||
 	    card->info.type == QETH_CARD_TYPE_OSX) {
-- 
2.13.5

WARNING: multiple messages have this Message-ID (diff)
From: Julian Wiedmann <jwi@linux.vnet.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Stefan Raspl <raspl@linux.vnet.ibm.com>,
	Ursula Braun <ubraun@linux.vnet.ibm.com>,
	Julian Wiedmann <jwi@linux.vnet.ibm.com>
Subject: [PATCH net-next 07/13] s390/qeth: don't verify device when setting MAC address
Date: Wed, 18 Oct 2017 17:40:19 +0200	[thread overview]
Message-ID: <20171018154025.73630-8-jwi@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171018154025.73630-1-jwi@linux.vnet.ibm.com>

There's no reason why l2_set_mac_address() should ever be called for
a netdevice that's not owned by qeth. It's certainly not required for
VLAN devices, which have their own netdev_ops.

Also:
1) we don't do such validation for any of the other netdev_ops routines.
2) the code in question clearly has never been actually exercised;
   it's broken. After determining that the device is not owned
   by qeth, it would still use dev->ml_priv to write a qeth trace entry.

Remove the check, and its helper that walked the global card list.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_l2_main.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 7b61c2ef4c74..87aa8c2ab5b0 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -38,24 +38,6 @@ static void qeth_l2_vnicc_init(struct qeth_card *card);
 static bool qeth_l2_vnicc_recover_timeout(struct qeth_card *card, u32 vnicc,
 					  u32 *timeout);
 
-static int qeth_l2_verify_dev(struct net_device *dev)
-{
-	struct qeth_card *card;
-	unsigned long flags;
-	int rc = 0;
-
-	read_lock_irqsave(&qeth_core_card_list.rwlock, flags);
-	list_for_each_entry(card, &qeth_core_card_list.list, list) {
-		if (card->dev == dev) {
-			rc = QETH_REAL_CARD;
-			break;
-		}
-	}
-	read_unlock_irqrestore(&qeth_core_card_list.rwlock, flags);
-
-	return rc;
-}
-
 static struct net_device *qeth_l2_netdev_by_devno(unsigned char *read_dev_no)
 {
 	struct qeth_card *card;
@@ -568,11 +550,6 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p)
 
 	QETH_CARD_TEXT(card, 3, "setmac");
 
-	if (qeth_l2_verify_dev(dev) != QETH_REAL_CARD) {
-		QETH_CARD_TEXT(card, 3, "setmcINV");
-		return -EOPNOTSUPP;
-	}
-
 	if (card->info.type == QETH_CARD_TYPE_OSN ||
 	    card->info.type == QETH_CARD_TYPE_OSM ||
 	    card->info.type == QETH_CARD_TYPE_OSX) {
-- 
2.13.5

  parent reply	other threads:[~2017-10-18 15:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18 15:40 [PATCH net-next 00/13] s390/net: updates 2017-10-18 Julian Wiedmann
2017-10-18 15:40 ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 01/13] s390/qeth: rely on kernel for feature recovery Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 02/13] s390/drivers: use setup_timer Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 03/13] s390/qeth: remove duplicated device matching Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 04/13] s390/qeth: use kstrtobool() in qeth_bridgeport_hostnotification_store() Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 05/13] s390/qeth: fix early exit from error path Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 06/13] s390/qeth: clean up initial MTU determination Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` Julian Wiedmann [this message]
2017-10-18 15:40   ` [PATCH net-next 07/13] s390/qeth: don't verify device when setting MAC address Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 08/13] s390/qeth: no VLAN support on OSM Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 09/13] s390/qeth: clean up page frag creation Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 10/13] s390/qeth: consolidate skb allocation Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 11/13] s390/qeth: try harder to get packets from RX buffer Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 15:40 ` [PATCH net-next 12/13] s390/qeth: support GRO flush timer Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-18 16:08   ` Eric Dumazet
2017-10-18 15:40 ` [PATCH net-next 13/13] s390/qeth: don't dump control cmd twice Julian Wiedmann
2017-10-18 15:40   ` Julian Wiedmann
2017-10-20 12:12 ` [PATCH net-next 00/13] s390/net: updates 2017-10-18 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171018154025.73630-8-jwi@linux.vnet.ibm.com \
    --to=jwi@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=raspl@linux.vnet.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=ubraun@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.