From: Greg Kroah-Hartman Date: Fri, 7 Sep 2018 08:42:14 +0000 (+0200) Subject: 4.18-stable patches X-Git-Tag: v4.18.7~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53119226516ccab0a979edc365a238ceb79c41a2;p=thirdparty%2Fkernel%2Fstable-queue.git 4.18-stable patches added patches: 9p-net-fix-zero-copy-path-in-the-9p-virtio-transport.patch net-6lowpan-fix-reserved-space-for-single-frames.patch net-mac802154-tx-expand-tailroom-if-necessary.patch --- diff --git a/queue-4.18/9p-net-fix-zero-copy-path-in-the-9p-virtio-transport.patch b/queue-4.18/9p-net-fix-zero-copy-path-in-the-9p-virtio-transport.patch new file mode 100644 index 00000000000..44a35751b96 --- /dev/null +++ b/queue-4.18/9p-net-fix-zero-copy-path-in-the-9p-virtio-transport.patch @@ -0,0 +1,59 @@ +From d28c756caee6e414d9ba367d0b92da24145af2a8 Mon Sep 17 00:00:00 2001 +From: Chirantan Ekbote +Date: Mon, 16 Jul 2018 17:35:29 -0700 +Subject: 9p/net: Fix zero-copy path in the 9p virtio transport + +From: Chirantan Ekbote + +commit d28c756caee6e414d9ba367d0b92da24145af2a8 upstream. + +The zero-copy optimization when reading or writing large chunks of data +is quite useful. However, the 9p messages created through the zero-copy +write path have an incorrect message size: it should be the size of the +header + size of the data being written but instead it's just the size +of the header. + +This only works if the server ignores the size field of the message and +otherwise breaks the framing of the protocol. Fix this by re-writing the +message size field with the correct value. + +Tested by running `dd if=/dev/zero of=out bs=4k count=1` inside a +virtio-9p mount. + +Link: http://lkml.kernel.org/r/20180717003529.114368-1-chirantan@chromium.org +Signed-off-by: Chirantan Ekbote +Reviewed-by: Greg Kurz +Tested-by: Greg Kurz +Cc: Dylan Reid +Cc: Guenter Roeck +Cc: stable@vger.kernel.org +Signed-off-by: Dominique Martinet +Signed-off-by: Greg Kroah-Hartman + +--- + net/9p/trans_virtio.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/net/9p/trans_virtio.c ++++ b/net/9p/trans_virtio.c +@@ -406,6 +406,7 @@ p9_virtio_zc_request(struct p9_client *c + p9_debug(P9_DEBUG_TRANS, "virtio request\n"); + + if (uodata) { ++ __le32 sz; + int n = p9_get_mapped_pages(chan, &out_pages, uodata, + outlen, &offs, &need_drop); + if (n < 0) +@@ -416,6 +417,12 @@ p9_virtio_zc_request(struct p9_client *c + memcpy(&req->tc->sdata[req->tc->size - 4], &v, 4); + outlen = n; + } ++ /* The size field of the message must include the length of the ++ * header and the length of the data. We didn't actually know ++ * the length of the data until this point so add it in now. ++ */ ++ sz = cpu_to_le32(req->tc->size + outlen); ++ memcpy(&req->tc->sdata[0], &sz, sizeof(sz)); + } else if (uidata) { + int n = p9_get_mapped_pages(chan, &in_pages, uidata, + inlen, &offs, &need_drop); diff --git a/queue-4.18/net-6lowpan-fix-reserved-space-for-single-frames.patch b/queue-4.18/net-6lowpan-fix-reserved-space-for-single-frames.patch new file mode 100644 index 00000000000..4ac566862ab --- /dev/null +++ b/queue-4.18/net-6lowpan-fix-reserved-space-for-single-frames.patch @@ -0,0 +1,57 @@ +From ac74f87c789af40936a80131c4759f3e72579c3a Mon Sep 17 00:00:00 2001 +From: Alexander Aring +Date: Sat, 14 Jul 2018 12:52:10 -0400 +Subject: net: 6lowpan: fix reserved space for single frames + +From: Alexander Aring + +commit ac74f87c789af40936a80131c4759f3e72579c3a upstream. + +This patch fixes patch add handling to take care tail and headroom for +single 6lowpan frames. We need to be sure we have a skb with the right +head and tailroom for single frames. This patch do it by using +skb_copy_expand() if head and tailroom is not enough allocated by upper +layer. + +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195059 +Reported-by: David Palma +Reported-by: Rabi Narayan Sahoo +Cc: stable@vger.kernel.org +Signed-off-by: Alexander Aring +Signed-off-by: Stefan Schmidt +Signed-off-by: Greg Kroah-Hartman + +--- + net/ieee802154/6lowpan/tx.c | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +--- a/net/ieee802154/6lowpan/tx.c ++++ b/net/ieee802154/6lowpan/tx.c +@@ -265,9 +265,24 @@ netdev_tx_t lowpan_xmit(struct sk_buff * + /* We must take a copy of the skb before we modify/replace the ipv6 + * header as the header could be used elsewhere + */ +- skb = skb_unshare(skb, GFP_ATOMIC); +- if (!skb) +- return NET_XMIT_DROP; ++ if (unlikely(skb_headroom(skb) < ldev->needed_headroom || ++ skb_tailroom(skb) < ldev->needed_tailroom)) { ++ struct sk_buff *nskb; ++ ++ nskb = skb_copy_expand(skb, ldev->needed_headroom, ++ ldev->needed_tailroom, GFP_ATOMIC); ++ if (likely(nskb)) { ++ consume_skb(skb); ++ skb = nskb; ++ } else { ++ kfree_skb(skb); ++ return NET_XMIT_DROP; ++ } ++ } else { ++ skb = skb_unshare(skb, GFP_ATOMIC); ++ if (!skb) ++ return NET_XMIT_DROP; ++ } + + ret = lowpan_header(skb, ldev, &dgram_size, &dgram_offset); + if (ret < 0) { diff --git a/queue-4.18/net-mac802154-tx-expand-tailroom-if-necessary.patch b/queue-4.18/net-mac802154-tx-expand-tailroom-if-necessary.patch new file mode 100644 index 00000000000..fc1acb86ee0 --- /dev/null +++ b/queue-4.18/net-mac802154-tx-expand-tailroom-if-necessary.patch @@ -0,0 +1,48 @@ +From f9c52831133050c6b82aa8b6831c92da2bbf2a0b Mon Sep 17 00:00:00 2001 +From: Alexander Aring +Date: Mon, 2 Jul 2018 16:32:03 -0400 +Subject: net: mac802154: tx: expand tailroom if necessary + +From: Alexander Aring + +commit f9c52831133050c6b82aa8b6831c92da2bbf2a0b upstream. + +This patch is necessary if case of AF_PACKET or other socket interface +which I am aware of it and didn't allocated the necessary room. + +Reported-by: David Palma +Reported-by: Rabi Narayan Sahoo +Cc: stable@vger.kernel.org +Signed-off-by: Alexander Aring +Signed-off-by: Stefan Schmidt +Signed-off-by: Greg Kroah-Hartman + +--- + net/mac802154/tx.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +--- a/net/mac802154/tx.c ++++ b/net/mac802154/tx.c +@@ -63,8 +63,21 @@ ieee802154_tx(struct ieee802154_local *l + int ret; + + if (!(local->hw.flags & IEEE802154_HW_TX_OMIT_CKSUM)) { +- u16 crc = crc_ccitt(0, skb->data, skb->len); ++ struct sk_buff *nskb; ++ u16 crc; + ++ if (unlikely(skb_tailroom(skb) < IEEE802154_FCS_LEN)) { ++ nskb = skb_copy_expand(skb, 0, IEEE802154_FCS_LEN, ++ GFP_ATOMIC); ++ if (likely(nskb)) { ++ consume_skb(skb); ++ skb = nskb; ++ } else { ++ goto err_tx; ++ } ++ } ++ ++ crc = crc_ccitt(0, skb->data, skb->len); + put_unaligned_le16(crc, skb_put(skb, 2)); + } + diff --git a/queue-4.18/series b/queue-4.18/series index 1c7b6cb9308..d9a1ec99f21 100644 --- a/queue-4.18/series +++ b/queue-4.18/series @@ -1 +1,4 @@ rcu-make-expedited-gps-handle-cpu-0-being-offline.patch +net-6lowpan-fix-reserved-space-for-single-frames.patch +net-mac802154-tx-expand-tailroom-if-necessary.patch +9p-net-fix-zero-copy-path-in-the-9p-virtio-transport.patch