netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] s390/qeth: fixes 2019-10-08
@ 2019-10-08 16:21 Julian Wiedmann
  2019-10-08 16:21 ` [PATCH net 1/2] s390/qeth: Fix error handling during VNICC initialization Julian Wiedmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Julian Wiedmann @ 2019-10-08 16:21 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Heiko Carstens, Stefan Raspl, Ursula Braun,
	Julian Wiedmann

Hi Dave,

please apply the following two patches to your net tree.

Alexandra fixes two issues in the initialization code for vnicc cmds.
One is an uninitialized variable when a cmd fails, the other that we
wouldn't recover correctly if the device's supported features changed.

Thanks,
Julian


Alexandra Winter (2):
  s390/qeth: Fix error handling during VNICC initialization
  s390/qeth: Fix initialization of vnicc cmd masks during set online

 drivers/s390/net/qeth_l2_main.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] s390/qeth: Fix error handling during VNICC initialization
  2019-10-08 16:21 [PATCH net 0/2] s390/qeth: fixes 2019-10-08 Julian Wiedmann
@ 2019-10-08 16:21 ` Julian Wiedmann
  2019-10-08 16:21 ` [PATCH net 2/2] s390/qeth: Fix initialization of vnicc cmd masks during set online Julian Wiedmann
  2019-10-10  1:05 ` [PATCH net 0/2] s390/qeth: fixes 2019-10-08 Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Julian Wiedmann @ 2019-10-08 16:21 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Heiko Carstens, Stefan Raspl, Ursula Braun,
	Alexandra Winter, Julian Wiedmann

From: Alexandra Winter <wintera@linux.ibm.com>

Smatch discovered the use of uninitialized variable sup_cmds
in error paths.

Fixes: caa1f0b10d18 ("s390/qeth: add VNICC enable/disable support")
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 drivers/s390/net/qeth_l2_main.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index b8799cd3e7aa..de62a9ccc882 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -2021,10 +2021,10 @@ static bool qeth_l2_vnicc_recover_char(struct qeth_card *card, u32 vnicc,
 static void qeth_l2_vnicc_init(struct qeth_card *card)
 {
 	u32 *timeout = &card->options.vnicc.learning_timeout;
+	bool enable, error = false;
 	unsigned int chars_len, i;
 	unsigned long chars_tmp;
 	u32 sup_cmds, vnicc;
-	bool enable, error;
 
 	QETH_CARD_TEXT(card, 2, "vniccini");
 	/* reset rx_bcast */
@@ -2045,7 +2045,10 @@ static void qeth_l2_vnicc_init(struct qeth_card *card)
 	chars_len = sizeof(card->options.vnicc.sup_chars) * BITS_PER_BYTE;
 	for_each_set_bit(i, &chars_tmp, chars_len) {
 		vnicc = BIT(i);
-		qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds);
+		if (qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds)) {
+			sup_cmds = 0;
+			error = true;
+		}
 		if (!(sup_cmds & IPA_VNICC_SET_TIMEOUT) ||
 		    !(sup_cmds & IPA_VNICC_GET_TIMEOUT))
 			card->options.vnicc.getset_timeout_sup &= ~vnicc;
@@ -2054,8 +2057,8 @@ static void qeth_l2_vnicc_init(struct qeth_card *card)
 			card->options.vnicc.set_char_sup &= ~vnicc;
 	}
 	/* enforce assumed default values and recover settings, if changed  */
-	error = qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING,
-					      timeout);
+	error |= qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING,
+					       timeout);
 	chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT;
 	chars_tmp |= QETH_VNICC_BRIDGE_INVISIBLE;
 	chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] s390/qeth: Fix initialization of vnicc cmd masks during set online
  2019-10-08 16:21 [PATCH net 0/2] s390/qeth: fixes 2019-10-08 Julian Wiedmann
  2019-10-08 16:21 ` [PATCH net 1/2] s390/qeth: Fix error handling during VNICC initialization Julian Wiedmann
@ 2019-10-08 16:21 ` Julian Wiedmann
  2019-10-10  1:05 ` [PATCH net 0/2] s390/qeth: fixes 2019-10-08 Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Julian Wiedmann @ 2019-10-08 16:21 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Heiko Carstens, Stefan Raspl, Ursula Braun,
	Alexandra Winter, Julian Wiedmann

From: Alexandra Winter <wintera@linux.ibm.com>

Without this patch, a command bit in the supported commands mask is only
ever set to unsupported during set online. If a command is ever marked as
unsupported (e.g. because of error during qeth_l2_vnicc_query_cmds),
subsequent successful initialization (offline/online) would not bring it
back.

Fixes: caa1f0b10d18 ("s390/qeth: add VNICC enable/disable support")
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 drivers/s390/net/qeth_l2_main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index de62a9ccc882..bd8143e51747 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -2049,11 +2049,15 @@ static void qeth_l2_vnicc_init(struct qeth_card *card)
 			sup_cmds = 0;
 			error = true;
 		}
-		if (!(sup_cmds & IPA_VNICC_SET_TIMEOUT) ||
-		    !(sup_cmds & IPA_VNICC_GET_TIMEOUT))
+		if ((sup_cmds & IPA_VNICC_SET_TIMEOUT) &&
+		    (sup_cmds & IPA_VNICC_GET_TIMEOUT))
+			card->options.vnicc.getset_timeout_sup |= vnicc;
+		else
 			card->options.vnicc.getset_timeout_sup &= ~vnicc;
-		if (!(sup_cmds & IPA_VNICC_ENABLE) ||
-		    !(sup_cmds & IPA_VNICC_DISABLE))
+		if ((sup_cmds & IPA_VNICC_ENABLE) &&
+		    (sup_cmds & IPA_VNICC_DISABLE))
+			card->options.vnicc.set_char_sup |= vnicc;
+		else
 			card->options.vnicc.set_char_sup &= ~vnicc;
 	}
 	/* enforce assumed default values and recover settings, if changed  */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] s390/qeth: fixes 2019-10-08
  2019-10-08 16:21 [PATCH net 0/2] s390/qeth: fixes 2019-10-08 Julian Wiedmann
  2019-10-08 16:21 ` [PATCH net 1/2] s390/qeth: Fix error handling during VNICC initialization Julian Wiedmann
  2019-10-08 16:21 ` [PATCH net 2/2] s390/qeth: Fix initialization of vnicc cmd masks during set online Julian Wiedmann
@ 2019-10-10  1:05 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2019-10-10  1:05 UTC (permalink / raw)
  To: Julian Wiedmann
  Cc: David Miller, netdev, linux-s390, Heiko Carstens, Stefan Raspl,
	Ursula Braun

On Tue,  8 Oct 2019 18:21:05 +0200, Julian Wiedmann wrote:
> Hi Dave,
> 
> please apply the following two patches to your net tree.
> 
> Alexandra fixes two issues in the initialization code for vnicc cmds.
> One is an uninitialized variable when a cmd fails, the other that we
> wouldn't recover correctly if the device's supported features changed.

Applied, and queued for stable.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-10  1:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 16:21 [PATCH net 0/2] s390/qeth: fixes 2019-10-08 Julian Wiedmann
2019-10-08 16:21 ` [PATCH net 1/2] s390/qeth: Fix error handling during VNICC initialization Julian Wiedmann
2019-10-08 16:21 ` [PATCH net 2/2] s390/qeth: Fix initialization of vnicc cmd masks during set online Julian Wiedmann
2019-10-10  1:05 ` [PATCH net 0/2] s390/qeth: fixes 2019-10-08 Jakub Kicinski

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).