Skip to contentSkip to conversation

s390/qeth: fixes 2018-09-12

PATCH In review Julian Wiedmann 2 participants 6 messages Sep 12, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover s390/qeth: fixes 2018-09-12

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(-)
Signature · 1 line
2.16.4
#1 lore raw

PATCH 1/4 s390/qeth: indicate error when netdev allocation fails

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")
---
 drivers/s390/net/qeth_core_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/s390/net/qeth_core_main.c +3 -1
index 49f64eb3eab0..6b24face21d5 100644
@@ -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);
Signature · 1 line
2.16.4
#2 lore raw

PATCH 2/4 s390/qeth: switch on SG by default for IQD devices

In reply to 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.

---
 drivers/s390/net/qeth_core_main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/s390/net/qeth_core_main.c +2 -0
index 6b24face21d5..b60055e9cb1a 100644
@@ -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;
Signature · 1 line
2.16.4
#3 lore raw

PATCH 3/4 s390/qeth: use vzalloc for QUERY OAT buffer

In reply to Julian Wiedmann

From: Wenjia Zhang <[email protected]>

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.

---
 drivers/s390/net/qeth_core_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/s390/net/qeth_core_main.c +3 -2
index b60055e9cb1a..de8282420f96 100644
@@ -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;
 }
Signature · 1 line
2.16.4
#4 lore raw

PATCH 4/4 s390/qeth: don't dump past end of unknown HW header

In reply to 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.

---
 drivers/s390/net/qeth_l2_main.c | 2 +-
 drivers/s390/net/qeth_l3_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/s390/net/qeth_l2_main.c +1 -1
index 710fa74892ae..b5e38531733f 100644
@@ -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++;
drivers/s390/net/qeth_l3_main.c +1 -1
index 7175086677fb..ada258c01a08 100644
@@ -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++;
Signature · 1 line
2.16.4
maintainer
#5 lore raw
In reply to Julian Wiedmann

From: Julian Wiedmann <[email protected]>
Date: Wed, 12 Sep 2018 15:31:31 +0200

Quoted 6 lines

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.