netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/4] s390/qeth: fixes 2018-09-12
@ 2018-09-12 13:31 Julian Wiedmann
  2018-09-12 13:31 ` [PATCH net 1/4] s390/qeth: indicate error when netdev allocation fails Julian Wiedmann
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Julian Wiedmann @ 2018-09-12 13:31 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann

Hi Dave,

please apply the following qeth fixes for -net.

Patch 1 resolves a regression in an error path, while patch 2 enables
the SG support by default that was newly introduced with 4.19.
Patch 3 takes care of a longstanding problem with large-order
allocations, and patch 4 fixes a potential out-of-bounds access.

Thanks,
Julian


Julian Wiedmann (3):
  s390/qeth: indicate error when netdev allocation fails
  s390/qeth: switch on SG by default for IQD devices
  s390/qeth: don't dump past end of unknown HW header

Wenjia Zhang (1):
  s390/qeth: use vzalloc for QUERY OAT buffer

 drivers/s390/net/qeth_core_main.c | 11 ++++++++---
 drivers/s390/net/qeth_l2_main.c   |  2 +-
 drivers/s390/net/qeth_l3_main.c   |  2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

-- 
2.16.4

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

* [PATCH net 1/4] s390/qeth: indicate error when netdev allocation fails
  2018-09-12 13:31 [PATCH net 0/4] s390/qeth: fixes 2018-09-12 Julian Wiedmann
@ 2018-09-12 13:31 ` Julian Wiedmann
  2018-09-12 13:31 ` [PATCH net 2/4] s390/qeth: switch on SG by default for IQD devices Julian Wiedmann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Wiedmann @ 2018-09-12 13:31 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann

Bailing out on allocation error is nice, but we also need to tell the
ccwgroup core that creating the qeth groupdev failed.

Fixes: d3d1b205e89f ("s390/qeth: allocate netdevice early")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 drivers/s390/net/qeth_core_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 49f64eb3eab0..6b24face21d5 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5768,8 +5768,10 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
 	qeth_update_from_chp_desc(card);
 
 	card->dev = qeth_alloc_netdev(card);
-	if (!card->dev)
+	if (!card->dev) {
+		rc = -ENOMEM;
 		goto err_card;
+	}
 
 	qeth_determine_capabilities(card);
 	enforced_disc = qeth_enforce_discipline(card);
-- 
2.16.4

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

* [PATCH net 2/4] s390/qeth: switch on SG by default for IQD devices
  2018-09-12 13:31 [PATCH net 0/4] s390/qeth: fixes 2018-09-12 Julian Wiedmann
  2018-09-12 13:31 ` [PATCH net 1/4] s390/qeth: indicate error when netdev allocation fails Julian Wiedmann
@ 2018-09-12 13:31 ` Julian Wiedmann
  2018-09-12 13:31 ` [PATCH net 3/4] s390/qeth: use vzalloc for QUERY OAT buffer Julian Wiedmann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Wiedmann @ 2018-09-12 13:31 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann

Scatter-gather transmit brings a nice performance boost. Considering the
rather large MTU sizes at play, it's also totally the Right Thing To Do.

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

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 6b24face21d5..b60055e9cb1a 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5706,6 +5706,8 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card)
 		dev->priv_flags &= ~IFF_TX_SKB_SHARING;
 		dev->hw_features |= NETIF_F_SG;
 		dev->vlan_features |= NETIF_F_SG;
+		if (IS_IQD(card))
+			dev->features |= NETIF_F_SG;
 	}
 
 	return dev;
-- 
2.16.4

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

* [PATCH net 3/4] s390/qeth: use vzalloc for QUERY OAT buffer
  2018-09-12 13:31 [PATCH net 0/4] s390/qeth: fixes 2018-09-12 Julian Wiedmann
  2018-09-12 13:31 ` [PATCH net 1/4] s390/qeth: indicate error when netdev allocation fails Julian Wiedmann
  2018-09-12 13:31 ` [PATCH net 2/4] s390/qeth: switch on SG by default for IQD devices Julian Wiedmann
@ 2018-09-12 13:31 ` Julian Wiedmann
  2018-09-12 13:31 ` [PATCH net 4/4] s390/qeth: don't dump past end of unknown HW header Julian Wiedmann
  2018-09-12 20:13 ` [PATCH net 0/4] s390/qeth: fixes 2018-09-12 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Wiedmann @ 2018-09-12 13:31 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Wenjia Zhang, Julian Wiedmann

From: Wenjia Zhang <wenjia@linux.ibm.com>

qeth_query_oat_command() currently allocates the kernel buffer for
the SIOC_QETH_QUERY_OAT ioctl with kzalloc. So on systems with
fragmented memory, large allocations may fail (eg. the qethqoat tool by
default uses 132KB).

Solve this issue by using vzalloc, backing the allocation with
non-contiguous memory.

Signed-off-by: Wenjia Zhang <wenjia@linux.ibm.com>
Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 drivers/s390/net/qeth_core_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index b60055e9cb1a..de8282420f96 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -25,6 +25,7 @@
 #include <linux/netdevice.h>
 #include <linux/netdev_features.h>
 #include <linux/skbuff.h>
+#include <linux/vmalloc.h>
 
 #include <net/iucv/af_iucv.h>
 #include <net/dsfield.h>
@@ -4699,7 +4700,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
 
 	priv.buffer_len = oat_data.buffer_len;
 	priv.response_len = 0;
-	priv.buffer =  kzalloc(oat_data.buffer_len, GFP_KERNEL);
+	priv.buffer = vzalloc(oat_data.buffer_len);
 	if (!priv.buffer) {
 		rc = -ENOMEM;
 		goto out;
@@ -4740,7 +4741,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
 			rc = -EFAULT;
 
 out_free:
-	kfree(priv.buffer);
+	vfree(priv.buffer);
 out:
 	return rc;
 }
-- 
2.16.4

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

* [PATCH net 4/4] s390/qeth: don't dump past end of unknown HW header
  2018-09-12 13:31 [PATCH net 0/4] s390/qeth: fixes 2018-09-12 Julian Wiedmann
                   ` (2 preceding siblings ...)
  2018-09-12 13:31 ` [PATCH net 3/4] s390/qeth: use vzalloc for QUERY OAT buffer Julian Wiedmann
@ 2018-09-12 13:31 ` Julian Wiedmann
  2018-09-12 20:13 ` [PATCH net 0/4] s390/qeth: fixes 2018-09-12 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Wiedmann @ 2018-09-12 13:31 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann

For inbound data with an unsupported HW header format, only dump the
actual HW header. We have no idea how much payload follows it, and what
it contains. Worst case, we dump past the end of the Inbound Buffer and
access whatever is located next in memory.

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

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 710fa74892ae..b5e38531733f 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -423,7 +423,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
 		default:
 			dev_kfree_skb_any(skb);
 			QETH_CARD_TEXT(card, 3, "inbunkno");
-			QETH_DBF_HEX(CTRL, 3, hdr, QETH_DBF_CTRL_LEN);
+			QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
 			continue;
 		}
 		work_done++;
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 7175086677fb..ada258c01a08 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1390,7 +1390,7 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
 		default:
 			dev_kfree_skb_any(skb);
 			QETH_CARD_TEXT(card, 3, "inbunkno");
-			QETH_DBF_HEX(CTRL, 3, hdr, QETH_DBF_CTRL_LEN);
+			QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
 			continue;
 		}
 		work_done++;
-- 
2.16.4

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

* Re: [PATCH net 0/4] s390/qeth: fixes 2018-09-12
  2018-09-12 13:31 [PATCH net 0/4] s390/qeth: fixes 2018-09-12 Julian Wiedmann
                   ` (3 preceding siblings ...)
  2018-09-12 13:31 ` [PATCH net 4/4] s390/qeth: don't dump past end of unknown HW header Julian Wiedmann
@ 2018-09-12 20:13 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-09-12 20:13 UTC (permalink / raw)
  To: jwi; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, raspl, ubraun

From: Julian Wiedmann <jwi@linux.ibm.com>
Date: Wed, 12 Sep 2018 15:31:31 +0200

> please apply the following qeth fixes for -net.
> 
> Patch 1 resolves a regression in an error path, while patch 2 enables
> the SG support by default that was newly introduced with 4.19.
> Patch 3 takes care of a longstanding problem with large-order
> allocations, and patch 4 fixes a potential out-of-bounds access.

Series applied, thanks Julian.

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

end of thread, other threads:[~2018-09-13  1:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-12 13:31 [PATCH net 0/4] s390/qeth: fixes 2018-09-12 Julian Wiedmann
2018-09-12 13:31 ` [PATCH net 1/4] s390/qeth: indicate error when netdev allocation fails Julian Wiedmann
2018-09-12 13:31 ` [PATCH net 2/4] s390/qeth: switch on SG by default for IQD devices Julian Wiedmann
2018-09-12 13:31 ` [PATCH net 3/4] s390/qeth: use vzalloc for QUERY OAT buffer Julian Wiedmann
2018-09-12 13:31 ` [PATCH net 4/4] s390/qeth: don't dump past end of unknown HW header Julian Wiedmann
2018-09-12 20:13 ` [PATCH net 0/4] s390/qeth: fixes 2018-09-12 David Miller

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