netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julian Wiedmann <jwi@linux.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.ibm.com>,
	Ursula Braun <ubraun@linux.ibm.com>,
	Julian Wiedmann <jwi@linux.ibm.com>
Subject: [PATCH net-next 03/15] s390/qeth: fix discipline unload after setup error
Date: Wed, 26 Sep 2018 18:29:04 +0200	[thread overview]
Message-ID: <20180926162916.102720-4-jwi@linux.ibm.com> (raw)
In-Reply-To: <20180926162916.102720-1-jwi@linux.ibm.com>

Device initialization code usually first loads a subdriver
(via qeth_core_load_discipline()), and then runs its setup() callback.
If this fails, it rolls back the load via qeth_core_free_discipline().

qeth_core_free_discipline() expects the options.layer attribute to be
initialized, but on error in setup() that's currently not the case.
Resulting in misbalanced symbol_put() calls.

Fix this by setting options.layer when loading the subdriver.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 drivers/s390/net/qeth_core_main.c | 2 ++
 drivers/s390/net/qeth_core_sys.c  | 2 --
 drivers/s390/net/qeth_l2_main.c   | 1 -
 drivers/s390/net/qeth_l3_main.c   | 1 -
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index c3068f680f67..1fed8f113f40 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5614,6 +5614,7 @@ int qeth_core_load_discipline(struct qeth_card *card,
 		return -EINVAL;
 	}
 
+	card->options.layer = discipline;
 	return 0;
 }
 
@@ -5623,6 +5624,7 @@ void qeth_core_free_discipline(struct qeth_card *card)
 		symbol_put(qeth_l2_discipline);
 	else
 		symbol_put(qeth_l3_discipline);
+	card->options.layer = QETH_DISCIPLINE_UNDETERMINED;
 	card->discipline = NULL;
 }
 
diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index fdb67af811f4..970f6c71a66e 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -432,8 +432,6 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
 
 		card->discipline->remove(card->gdev);
 		qeth_core_free_discipline(card);
-		card->options.layer = QETH_DISCIPLINE_UNDETERMINED;
-
 		free_netdev(card->dev);
 		card->dev = ndev;
 	}
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index afa7a005b21e..02566af7e23d 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -806,7 +806,6 @@ static int qeth_l2_probe_device(struct ccwgroup_device *gdev)
 	}
 	INIT_LIST_HEAD(&card->vid_list);
 	hash_init(card->mac_htable);
-	card->options.layer = QETH_DISCIPLINE_LAYER2;
 	card->info.hwtrap = 0;
 	qeth_l2_vnicc_set_defaults(card);
 	return 0;
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 552bfad20f85..2756795f7708 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2489,7 +2489,6 @@ static int qeth_l3_probe_device(struct ccwgroup_device *gdev)
 	}
 	hash_init(card->ip_htable);
 	hash_init(card->ip_mc_htable);
-	card->options.layer = QETH_DISCIPLINE_LAYER3;
 	card->info.hwtrap = 0;
 	return 0;
 }
-- 
2.16.4

  parent reply	other threads:[~2018-09-26 22:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 16:29 [PATCH net-next 00/15] s390/net: updates 2018-09-26 Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 01/15] s390/qeth: convert layer attribute to enum Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 02/15] s390/qeth: use DEFINE_MUTEX for qeth_mod_mutex Julian Wiedmann
2018-09-26 16:29 ` Julian Wiedmann [this message]
2018-09-26 16:29 ` [PATCH net-next 04/15] s390/qeth: on gdev release, reset drvdata Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 05/15] net/af_iucv: locate IUCV header via skb_network_header() Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 06/15] s390/qeth: replace open-coded skb_queue_walk() Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 07/15] s390/qeth: remove additional skb refcount Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 08/15] s390/qeth: re-use qeth_notify_skbs() Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 09/15] s390/qeth: pass card pointer in iob callback Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 10/15] s390/qeth: remove CARD_FROM_CDEV helper Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 11/15] s390/qeth: remove various redundant code Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 12/15] s390/qeth: consume local address events Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 13/15] s390/qeth: re-indent qeth_check_ipa_data() Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 14/15] s390/qeth: clean up drop conditions for received cmds Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 15/15] s390/qeth: remove duplicated carrier state tracking Julian Wiedmann
2018-09-26 17:02 ` [PATCH net-next 00/15] s390/net: updates 2018-09-26 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=20180926162916.102720-4-jwi@linux.ibm.com \
    --to=jwi@linux.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.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=ubraun@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).