From: Greg Kroah-Hartman Date: Thu, 8 Mar 2018 18:56:17 +0000 (-0800) Subject: 4.4-stable patches X-Git-Tag: v4.14.25~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ee91dd14b4daf38a542e4fbf34a5897cef8a2bc;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: bridge-check-brport-attr-show-in-brport_show.patch fib_semantics-don-t-match-route-with-mismatching-tclassid.patch hdlc_ppp-carrier-detect-ok-don-t-turn-off-negotiation.patch ipv6-sit-work-around-bogus-gcc-8-wrestrict-warning.patch net-fix-race-on-decreasing-number-of-tx-queues.patch net-ipv4-don-t-allow-setting-net.ipv4.route.min_pmtu-below-68.patch netlink-ensure-to-loop-over-all-netns-in-genlmsg_multicast_allns.patch ppp-prevent-unregistered-channels-from-connecting-to-ppp-units.patch s390-qeth-fix-ipa-command-submission-race.patch s390-qeth-fix-setip-command-handling.patch sctp-fix-dst-refcnt-leak-in-sctp_v4_get_dst.patch sctp-fix-dst-refcnt-leak-in-sctp_v6_get_dst.patch sctp-verify-size-of-a-new-chunk-in-_sctp_make_chunk.patch udplite-fix-partial-checksum-initialization.patch --- diff --git a/queue-4.4/bridge-check-brport-attr-show-in-brport_show.patch b/queue-4.4/bridge-check-brport-attr-show-in-brport_show.patch new file mode 100644 index 00000000000..d1e58241f1b --- /dev/null +++ b/queue-4.4/bridge-check-brport-attr-show-in-brport_show.patch @@ -0,0 +1,48 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Xin Long +Date: Mon, 12 Feb 2018 17:15:40 +0800 +Subject: bridge: check brport attr show in brport_show + +From: Xin Long + + +[ Upstream commit 1b12580af1d0677c3c3a19e35bfe5d59b03f737f ] + +Now br_sysfs_if file flush doesn't have attr show. To read it will +cause kernel panic after users chmod u+r this file. + +Xiong found this issue when running the commands: + + ip link add br0 type bridge + ip link add type veth + ip link set veth0 master br0 + chmod u+r /sys/devices/virtual/net/veth0/brport/flush + timeout 3 cat /sys/devices/virtual/net/veth0/brport/flush + +kernel crashed with NULL a pointer dereference call trace. + +This patch is to fix it by return -EINVAL when brport_attr->show +is null, just the same as the check for brport_attr->store in +brport_store(). + +Fixes: 9cf637473c85 ("bridge: add sysfs hook to flush forwarding table") +Reported-by: Xiong Zhou +Signed-off-by: Xin Long +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/bridge/br_sysfs_if.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/net/bridge/br_sysfs_if.c ++++ b/net/bridge/br_sysfs_if.c +@@ -229,6 +229,9 @@ static ssize_t brport_show(struct kobjec + struct brport_attribute *brport_attr = to_brport_attr(attr); + struct net_bridge_port *p = to_brport(kobj); + ++ if (!brport_attr->show) ++ return -EINVAL; ++ + return brport_attr->show(p, buf); + } + diff --git a/queue-4.4/fib_semantics-don-t-match-route-with-mismatching-tclassid.patch b/queue-4.4/fib_semantics-don-t-match-route-with-mismatching-tclassid.patch new file mode 100644 index 00000000000..b207643eff6 --- /dev/null +++ b/queue-4.4/fib_semantics-don-t-match-route-with-mismatching-tclassid.patch @@ -0,0 +1,66 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Stefano Brivio +Date: Thu, 15 Feb 2018 09:46:03 +0100 +Subject: fib_semantics: Don't match route with mismatching tclassid + +From: Stefano Brivio + + +[ Upstream commit a8c6db1dfd1b1d18359241372bb204054f2c3174 ] + +In fib_nh_match(), if output interface or gateway are passed in +the FIB configuration, we don't have to check next hops of +multipath routes to conclude whether we have a match or not. + +However, we might still have routes with different realms +matching the same output interface and gateway configuration, +and this needs to cause the match to fail. Otherwise the first +route inserted in the FIB will match, regardless of the realms: + + # ip route add 1.1.1.1 dev eth0 table 1234 realms 1/2 + # ip route append 1.1.1.1 dev eth0 table 1234 realms 3/4 + # ip route list table 1234 + 1.1.1.1 dev eth0 scope link realms 1/2 + 1.1.1.1 dev eth0 scope link realms 3/4 + # ip route del 1.1.1.1 dev ens3 table 1234 realms 3/4 + # ip route list table 1234 + 1.1.1.1 dev ens3 scope link realms 3/4 + +whereas route with realms 3/4 should have been deleted instead. + +Explicitly check for fc_flow passed in the FIB configuration +(this comes from RTA_FLOW extracted by rtm_to_fib_config()) and +fail matching if it differs from nh_tclassid. + +The handling of RTA_FLOW for multipath routes later in +fib_nh_match() is still needed, as we can have multiple RTA_FLOW +attributes that need to be matched against the tclassid of each +next hop. + +v2: Check that fc_flow is set before discarding the match, so + that the user can still select the first matching rule by + not specifying any realm, as suggested by David Ahern. + +Reported-by: Jianlin Shi +Signed-off-by: Stefano Brivio +Acked-by: David Ahern +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/fib_semantics.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/net/ipv4/fib_semantics.c ++++ b/net/ipv4/fib_semantics.c +@@ -640,6 +640,11 @@ int fib_nh_match(struct fib_config *cfg, + fi->fib_nh, cfg)) + return 1; + } ++#ifdef CONFIG_IP_ROUTE_CLASSID ++ if (cfg->fc_flow && ++ cfg->fc_flow != fi->fib_nh->nh_tclassid) ++ return 1; ++#endif + if ((!cfg->fc_oif || cfg->fc_oif == fi->fib_nh->nh_oif) && + (!cfg->fc_gw || cfg->fc_gw == fi->fib_nh->nh_gw)) + return 0; diff --git a/queue-4.4/hdlc_ppp-carrier-detect-ok-don-t-turn-off-negotiation.patch b/queue-4.4/hdlc_ppp-carrier-detect-ok-don-t-turn-off-negotiation.patch new file mode 100644 index 00000000000..b52476e71ea --- /dev/null +++ b/queue-4.4/hdlc_ppp-carrier-detect-ok-don-t-turn-off-negotiation.patch @@ -0,0 +1,37 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Denis Du +Date: Sat, 24 Feb 2018 16:51:42 -0500 +Subject: hdlc_ppp: carrier detect ok, don't turn off negotiation + +From: Denis Du + + +[ Upstream commit b6c3bad1ba83af1062a7ff6986d9edc4f3d7fc8e ] + +Sometimes when physical lines have a just good noise to make the protocol +handshaking fail, but the carrier detect still good. Then after remove of +the noise, nobody will trigger this protocol to be start again to cause +the link to never come back. The fix is when the carrier is still on, not +terminate the protocol handshaking. + +Signed-off-by: Denis Du +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wan/hdlc_ppp.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/net/wan/hdlc_ppp.c ++++ b/drivers/net/wan/hdlc_ppp.c +@@ -574,7 +574,10 @@ static void ppp_timer(unsigned long arg) + ppp_cp_event(proto->dev, proto->pid, TO_GOOD, 0, 0, + 0, NULL); + proto->restart_counter--; +- } else ++ } else if (netif_carrier_ok(proto->dev)) ++ ppp_cp_event(proto->dev, proto->pid, TO_GOOD, 0, 0, ++ 0, NULL); ++ else + ppp_cp_event(proto->dev, proto->pid, TO_BAD, 0, 0, + 0, NULL); + break; diff --git a/queue-4.4/ipv6-sit-work-around-bogus-gcc-8-wrestrict-warning.patch b/queue-4.4/ipv6-sit-work-around-bogus-gcc-8-wrestrict-warning.patch new file mode 100644 index 00000000000..e4ea44f8621 --- /dev/null +++ b/queue-4.4/ipv6-sit-work-around-bogus-gcc-8-wrestrict-warning.patch @@ -0,0 +1,49 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Arnd Bergmann +Date: Thu, 22 Feb 2018 16:55:34 +0100 +Subject: ipv6 sit: work around bogus gcc-8 -Wrestrict warning + +From: Arnd Bergmann + + +[ Upstream commit ca79bec237f5809a7c3c59bd41cd0880aa889966 ] + +gcc-8 has a new warning that detects overlapping input and output arguments +in memcpy(). It triggers for sit_init_net() calling ipip6_tunnel_clone_6rd(), +which is actually correct: + +net/ipv6/sit.c: In function 'sit_init_net': +net/ipv6/sit.c:192:3: error: 'memcpy' source argument is the same as destination [-Werror=restrict] + +The problem here is that the logic detecting the memcpy() arguments finds them +to be the same, but the conditional that tests for the input and output of +ipip6_tunnel_clone_6rd() to be identical is not a compile-time constant. + +We know that netdev_priv(t->dev) is the same as t for a tunnel device, +and comparing "dev" directly here lets the compiler figure out as well +that 'dev == sitn->fb_tunnel_dev' when called from sit_init_net(), so +it no longer warns. + +This code is old, so Cc stable to make sure that we don't get the warning +for older kernels built with new gcc. + +Cc: Martin Sebor +Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83456 +Signed-off-by: Arnd Bergmann +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/sit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -176,7 +176,7 @@ static void ipip6_tunnel_clone_6rd(struc + #ifdef CONFIG_IPV6_SIT_6RD + struct ip_tunnel *t = netdev_priv(dev); + +- if (t->dev == sitn->fb_tunnel_dev) { ++ if (dev == sitn->fb_tunnel_dev) { + ipv6_addr_set(&t->ip6rd.prefix, htonl(0x20020000), 0, 0, 0); + t->ip6rd.relay_prefix = 0; + t->ip6rd.prefixlen = 16; diff --git a/queue-4.4/net-fix-race-on-decreasing-number-of-tx-queues.patch b/queue-4.4/net-fix-race-on-decreasing-number-of-tx-queues.patch new file mode 100644 index 00000000000..4c7393b7a97 --- /dev/null +++ b/queue-4.4/net-fix-race-on-decreasing-number-of-tx-queues.patch @@ -0,0 +1,68 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Jakub Kicinski +Date: Mon, 12 Feb 2018 21:35:31 -0800 +Subject: net: fix race on decreasing number of TX queues + +From: Jakub Kicinski + + +[ Upstream commit ac5b70198adc25c73fba28de4f78adcee8f6be0b ] + +netif_set_real_num_tx_queues() can be called when netdev is up. +That usually happens when user requests change of number of +channels/rings with ethtool -L. The procedure for changing +the number of queues involves resetting the qdiscs and setting +dev->num_tx_queues to the new value. When the new value is +lower than the old one, extra care has to be taken to ensure +ordering of accesses to the number of queues vs qdisc reset. + +Currently the queues are reset before new dev->num_tx_queues +is assigned, leaving a window of time where packets can be +enqueued onto the queues going down, leading to a likely +crash in the drivers, since most drivers don't check if TX +skbs are assigned to an active queue. + +Fixes: e6484930d7c7 ("net: allocate tx queues in register_netdevice") +Signed-off-by: Jakub Kicinski +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/core/dev.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -2183,8 +2183,11 @@ EXPORT_SYMBOL(netif_set_xps_queue); + */ + int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq) + { ++ bool disabling; + int rc; + ++ disabling = txq < dev->real_num_tx_queues; ++ + if (txq < 1 || txq > dev->num_tx_queues) + return -EINVAL; + +@@ -2200,15 +2203,19 @@ int netif_set_real_num_tx_queues(struct + if (dev->num_tc) + netif_setup_tc(dev, txq); + +- if (txq < dev->real_num_tx_queues) { ++ dev->real_num_tx_queues = txq; ++ ++ if (disabling) { ++ synchronize_net(); + qdisc_reset_all_tx_gt(dev, txq); + #ifdef CONFIG_XPS + netif_reset_xps_queues_gt(dev, txq); + #endif + } ++ } else { ++ dev->real_num_tx_queues = txq; + } + +- dev->real_num_tx_queues = txq; + return 0; + } + EXPORT_SYMBOL(netif_set_real_num_tx_queues); diff --git a/queue-4.4/net-ipv4-don-t-allow-setting-net.ipv4.route.min_pmtu-below-68.patch b/queue-4.4/net-ipv4-don-t-allow-setting-net.ipv4.route.min_pmtu-below-68.patch new file mode 100644 index 00000000000..4eb7a7c14f6 --- /dev/null +++ b/queue-4.4/net-ipv4-don-t-allow-setting-net.ipv4.route.min_pmtu-below-68.patch @@ -0,0 +1,64 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Sabrina Dubroca +Date: Mon, 26 Feb 2018 16:13:43 +0100 +Subject: net: ipv4: don't allow setting net.ipv4.route.min_pmtu below 68 + +From: Sabrina Dubroca + + +[ Upstream commit c7272c2f1229125f74f22dcdd59de9bbd804f1c8 ] + +According to RFC 1191 sections 3 and 4, ICMP frag-needed messages +indicating an MTU below 68 should be rejected: + + A host MUST never reduce its estimate of the Path MTU below 68 + octets. + +and (talking about ICMP frag-needed's Next-Hop MTU field): + + This field will never contain a value less than 68, since every + router "must be able to forward a datagram of 68 octets without + fragmentation". + +Furthermore, by letting net.ipv4.route.min_pmtu be set to negative +values, we can end up with a very large PMTU when (-1) is cast into u32. + +Let's also make ip_rt_min_pmtu a u32, since it's only ever compared to +unsigned ints. + +Reported-by: Jianlin Shi +Signed-off-by: Sabrina Dubroca +Reviewed-by: Stefano Brivio +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/route.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/net/ipv4/route.c ++++ b/net/ipv4/route.c +@@ -126,10 +126,13 @@ static int ip_rt_redirect_silence __read + static int ip_rt_error_cost __read_mostly = HZ; + static int ip_rt_error_burst __read_mostly = 5 * HZ; + static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ; +-static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; ++static u32 ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; + static int ip_rt_min_advmss __read_mostly = 256; + + static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT; ++ ++static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU; ++ + /* + * Interface to generic destination cache. + */ +@@ -2765,7 +2768,8 @@ static struct ctl_table ipv4_route_table + .data = &ip_rt_min_pmtu, + .maxlen = sizeof(int), + .mode = 0644, +- .proc_handler = proc_dointvec, ++ .proc_handler = proc_dointvec_minmax, ++ .extra1 = &ip_min_valid_pmtu, + }, + { + .procname = "min_adv_mss", diff --git a/queue-4.4/netlink-ensure-to-loop-over-all-netns-in-genlmsg_multicast_allns.patch b/queue-4.4/netlink-ensure-to-loop-over-all-netns-in-genlmsg_multicast_allns.patch new file mode 100644 index 00000000000..84b4490576f --- /dev/null +++ b/queue-4.4/netlink-ensure-to-loop-over-all-netns-in-genlmsg_multicast_allns.patch @@ -0,0 +1,62 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Nicolas Dichtel +Date: Tue, 6 Feb 2018 14:48:32 +0100 +Subject: netlink: ensure to loop over all netns in genlmsg_multicast_allns() + +From: Nicolas Dichtel + + +[ Upstream commit cb9f7a9a5c96a773bbc9c70660dc600cfff82f82 ] + +Nowadays, nlmsg_multicast() returns only 0 or -ESRCH but this was not the +case when commit 134e63756d5f was pushed. +However, there was no reason to stop the loop if a netns does not have +listeners. +Returns -ESRCH only if there was no listeners in all netns. + +To avoid having the same problem in the future, I didn't take the +assumption that nlmsg_multicast() returns only 0 or -ESRCH. + +Fixes: 134e63756d5f ("genetlink: make netns aware") +CC: Johannes Berg +Signed-off-by: Nicolas Dichtel +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/netlink/genetlink.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/net/netlink/genetlink.c ++++ b/net/netlink/genetlink.c +@@ -1118,6 +1118,7 @@ static int genlmsg_mcast(struct sk_buff + { + struct sk_buff *tmp; + struct net *net, *prev = NULL; ++ bool delivered = false; + int err; + + for_each_net_rcu(net) { +@@ -1129,14 +1130,21 @@ static int genlmsg_mcast(struct sk_buff + } + err = nlmsg_multicast(prev->genl_sock, tmp, + portid, group, flags); +- if (err) ++ if (!err) ++ delivered = true; ++ else if (err != -ESRCH) + goto error; + } + + prev = net; + } + +- return nlmsg_multicast(prev->genl_sock, skb, portid, group, flags); ++ err = nlmsg_multicast(prev->genl_sock, skb, portid, group, flags); ++ if (!err) ++ delivered = true; ++ else if (err != -ESRCH) ++ goto error; ++ return delivered ? 0 : -ESRCH; + error: + kfree_skb(skb); + return err; diff --git a/queue-4.4/ppp-prevent-unregistered-channels-from-connecting-to-ppp-units.patch b/queue-4.4/ppp-prevent-unregistered-channels-from-connecting-to-ppp-units.patch new file mode 100644 index 00000000000..f0773d5c8de --- /dev/null +++ b/queue-4.4/ppp-prevent-unregistered-channels-from-connecting-to-ppp-units.patch @@ -0,0 +1,60 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Guillaume Nault +Date: Fri, 2 Mar 2018 18:41:16 +0100 +Subject: ppp: prevent unregistered channels from connecting to PPP units + +From: Guillaume Nault + + +[ Upstream commit 77f840e3e5f09c6d7d727e85e6e08276dd813d11 ] + +PPP units don't hold any reference on the channels connected to it. +It is the channel's responsibility to ensure that it disconnects from +its unit before being destroyed. +In practice, this is ensured by ppp_unregister_channel() disconnecting +the channel from the unit before dropping a reference on the channel. + +However, it is possible for an unregistered channel to connect to a PPP +unit: register a channel with ppp_register_net_channel(), attach a +/dev/ppp file to it with ioctl(PPPIOCATTCHAN), unregister the channel +with ppp_unregister_channel() and finally connect the /dev/ppp file to +a PPP unit with ioctl(PPPIOCCONNECT). + +Once in this situation, the channel is only held by the /dev/ppp file, +which can be released at anytime and free the channel without letting +the parent PPP unit know. Then the ppp structure ends up with dangling +pointers in its ->channels list. + +Prevent this scenario by forbidding unregistered channels from +connecting to PPP units. This maintains the code logic by keeping +ppp_unregister_channel() responsible from disconnecting the channel if +necessary and avoids modification on the reference counting mechanism. + +This issue seems to predate git history (successfully reproduced on +Linux 2.6.26 and earlier PPP commits are unrelated). + +Signed-off-by: Guillaume Nault +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ppp/ppp_generic.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/net/ppp/ppp_generic.c ++++ b/drivers/net/ppp/ppp_generic.c +@@ -2952,6 +2952,15 @@ ppp_connect_channel(struct channel *pch, + goto outl; + + ppp_lock(ppp); ++ spin_lock_bh(&pch->downl); ++ if (!pch->chan) { ++ /* Don't connect unregistered channels */ ++ spin_unlock_bh(&pch->downl); ++ ppp_unlock(ppp); ++ ret = -ENOTCONN; ++ goto outl; ++ } ++ spin_unlock_bh(&pch->downl); + if (pch->file.hdrlen > ppp->file.hdrlen) + ppp->file.hdrlen = pch->file.hdrlen; + hdrlen = pch->file.hdrlen + 2; /* for protocol bytes */ diff --git a/queue-4.4/s390-qeth-fix-ipa-command-submission-race.patch b/queue-4.4/s390-qeth-fix-ipa-command-submission-race.patch new file mode 100644 index 00000000000..89432cdf917 --- /dev/null +++ b/queue-4.4/s390-qeth-fix-ipa-command-submission-race.patch @@ -0,0 +1,84 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Julian Wiedmann +Date: Tue, 27 Feb 2018 18:58:17 +0100 +Subject: s390/qeth: fix IPA command submission race + +From: Julian Wiedmann + + +[ Upstream commit d22ffb5a712f9211ffd104c38fc17cbfb1b5e2b0 ] + +If multiple IPA commands are build & sent out concurrently, +fill_ipacmd_header() may assign a seqno value to a command that's +different from what send_control_data() later assigns to this command's +reply. +This is due to other commands passing through send_control_data(), +and incrementing card->seqno.ipa along the way. + +So one IPA command has no reply that's waiting for its seqno, while some +other IPA command has multiple reply objects waiting for it. +Only one of those waiting replies wins, and the other(s) times out and +triggers a recovery via send_ipa_cmd(). + +Fix this by making sure that the same seqno value is assigned to +a command and its reply object. +Do so immediately before submitting the command & while holding the +irq_pending "lock", to produce nicely ascending seqnos. + +As a side effect, *all* IPA commands now use a reply object that's +waiting for its actual seqno. Previously, early IPA commands that were +submitted while the card was still DOWN used the "catch-all" IDX seqno. + +Signed-off-by: Julian Wiedmann +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/s390/net/qeth_core_main.c | 19 ++++++++++--------- + 1 file changed, 10 insertions(+), 9 deletions(-) + +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -2068,25 +2068,26 @@ int qeth_send_control_data(struct qeth_c + } + reply->callback = reply_cb; + reply->param = reply_param; +- if (card->state == CARD_STATE_DOWN) +- reply->seqno = QETH_IDX_COMMAND_SEQNO; +- else +- reply->seqno = card->seqno.ipa++; ++ + init_waitqueue_head(&reply->wait_q); +- spin_lock_irqsave(&card->lock, flags); +- list_add_tail(&reply->list, &card->cmd_waiter_list); +- spin_unlock_irqrestore(&card->lock, flags); + QETH_DBF_HEX(CTRL, 2, iob->data, QETH_DBF_CTRL_LEN); + + while (atomic_cmpxchg(&card->write.irq_pending, 0, 1)) ; +- qeth_prepare_control_data(card, len, iob); + + if (IS_IPA(iob->data)) { + cmd = __ipa_cmd(iob); ++ cmd->hdr.seqno = card->seqno.ipa++; ++ reply->seqno = cmd->hdr.seqno; + event_timeout = QETH_IPA_TIMEOUT; + } else { ++ reply->seqno = QETH_IDX_COMMAND_SEQNO; + event_timeout = QETH_TIMEOUT; + } ++ qeth_prepare_control_data(card, len, iob); ++ ++ spin_lock_irqsave(&card->lock, flags); ++ list_add_tail(&reply->list, &card->cmd_waiter_list); ++ spin_unlock_irqrestore(&card->lock, flags); + + timeout = jiffies + event_timeout; + +@@ -2879,7 +2880,7 @@ static void qeth_fill_ipacmd_header(stru + memset(cmd, 0, sizeof(struct qeth_ipa_cmd)); + cmd->hdr.command = command; + cmd->hdr.initiator = IPA_CMD_INITIATOR_HOST; +- cmd->hdr.seqno = card->seqno.ipa; ++ /* cmd->hdr.seqno is set by qeth_send_control_data() */ + cmd->hdr.adapter_type = qeth_get_ipa_adp_type(card->info.link_type); + cmd->hdr.rel_adapter_no = (__u8) card->info.portno; + if (card->options.layer2) diff --git a/queue-4.4/s390-qeth-fix-setip-command-handling.patch b/queue-4.4/s390-qeth-fix-setip-command-handling.patch new file mode 100644 index 00000000000..f4df7c14599 --- /dev/null +++ b/queue-4.4/s390-qeth-fix-setip-command-handling.patch @@ -0,0 +1,76 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Julian Wiedmann +Date: Fri, 9 Feb 2018 11:03:50 +0100 +Subject: s390/qeth: fix SETIP command handling + +From: Julian Wiedmann + + +[ Upstream commit 1c5b2216fbb973a9410e0b06389740b5c1289171 ] + +send_control_data() applies some special handling to SETIP v4 IPA +commands. But current code parses *all* command types for the SETIP +command code. Limit the command code check to IPA commands. + +Fixes: 5b54e16f1a54 ("qeth: do not spin for SETIP ip assist command") +Signed-off-by: Julian Wiedmann +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/s390/net/qeth_core.h | 5 +++++ + drivers/s390/net/qeth_core_main.c | 14 ++++++++------ + 2 files changed, 13 insertions(+), 6 deletions(-) + +--- a/drivers/s390/net/qeth_core.h ++++ b/drivers/s390/net/qeth_core.h +@@ -591,6 +591,11 @@ struct qeth_cmd_buffer { + void (*callback) (struct qeth_channel *, struct qeth_cmd_buffer *); + }; + ++static inline struct qeth_ipa_cmd *__ipa_cmd(struct qeth_cmd_buffer *iob) ++{ ++ return (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE); ++} ++ + /** + * definition of a qeth channel, used for read and write + */ +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -2054,7 +2054,7 @@ int qeth_send_control_data(struct qeth_c + unsigned long flags; + struct qeth_reply *reply = NULL; + unsigned long timeout, event_timeout; +- struct qeth_ipa_cmd *cmd; ++ struct qeth_ipa_cmd *cmd = NULL; + + QETH_CARD_TEXT(card, 2, "sendctl"); + +@@ -2081,10 +2081,13 @@ int qeth_send_control_data(struct qeth_c + while (atomic_cmpxchg(&card->write.irq_pending, 0, 1)) ; + qeth_prepare_control_data(card, len, iob); + +- if (IS_IPA(iob->data)) ++ if (IS_IPA(iob->data)) { ++ cmd = __ipa_cmd(iob); + event_timeout = QETH_IPA_TIMEOUT; +- else ++ } else { + event_timeout = QETH_TIMEOUT; ++ } ++ + timeout = jiffies + event_timeout; + + QETH_CARD_TEXT(card, 6, "noirqpnd"); +@@ -2109,9 +2112,8 @@ int qeth_send_control_data(struct qeth_c + + /* we have only one long running ipassist, since we can ensure + process context of this command we can sleep */ +- cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); +- if ((cmd->hdr.command == IPA_CMD_SETIP) && +- (cmd->hdr.prot_version == QETH_PROT_IPV4)) { ++ if (cmd && cmd->hdr.command == IPA_CMD_SETIP && ++ cmd->hdr.prot_version == QETH_PROT_IPV4) { + if (!wait_event_timeout(reply->wait_q, + atomic_read(&reply->received), event_timeout)) + goto time_err; diff --git a/queue-4.4/sctp-fix-dst-refcnt-leak-in-sctp_v4_get_dst.patch b/queue-4.4/sctp-fix-dst-refcnt-leak-in-sctp_v4_get_dst.patch new file mode 100644 index 00000000000..27afd8911be --- /dev/null +++ b/queue-4.4/sctp-fix-dst-refcnt-leak-in-sctp_v4_get_dst.patch @@ -0,0 +1,86 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Tommi Rantala +Date: Mon, 5 Feb 2018 21:48:14 +0200 +Subject: sctp: fix dst refcnt leak in sctp_v4_get_dst + +From: Tommi Rantala + + +[ Upstream commit 4a31a6b19f9ddf498c81f5c9b089742b7472a6f8 ] + +Fix dst reference count leak in sctp_v4_get_dst() introduced in commit +410f03831 ("sctp: add routing output fallback"): + +When walking the address_list, successive ip_route_output_key() calls +may return the same rt->dst with the reference incremented on each call. + +The code would not decrement the dst refcount when the dst pointer was +identical from the previous iteration, causing the dst refcnt leak. + +Testcase: + ip netns add TEST + ip netns exec TEST ip link set lo up + ip link add dummy0 type dummy + ip link add dummy1 type dummy + ip link add dummy2 type dummy + ip link set dev dummy0 netns TEST + ip link set dev dummy1 netns TEST + ip link set dev dummy2 netns TEST + ip netns exec TEST ip addr add 192.168.1.1/24 dev dummy0 + ip netns exec TEST ip link set dummy0 up + ip netns exec TEST ip addr add 192.168.1.2/24 dev dummy1 + ip netns exec TEST ip link set dummy1 up + ip netns exec TEST ip addr add 192.168.1.3/24 dev dummy2 + ip netns exec TEST ip link set dummy2 up + ip netns exec TEST sctp_test -H 192.168.1.2 -P 20002 -h 192.168.1.1 -p 20000 -s -B 192.168.1.3 + ip netns del TEST + +In 4.4 and 4.9 kernels this results to: + [ 354.179591] unregister_netdevice: waiting for lo to become free. Usage count = 1 + [ 364.419674] unregister_netdevice: waiting for lo to become free. Usage count = 1 + [ 374.663664] unregister_netdevice: waiting for lo to become free. Usage count = 1 + [ 384.903717] unregister_netdevice: waiting for lo to become free. Usage count = 1 + [ 395.143724] unregister_netdevice: waiting for lo to become free. Usage count = 1 + [ 405.383645] unregister_netdevice: waiting for lo to become free. Usage count = 1 + ... + +Fixes: 410f03831 ("sctp: add routing output fallback") +Fixes: 0ca50d12f ("sctp: fix src address selection if using secondary addresses") +Signed-off-by: Tommi Rantala +Acked-by: Marcelo Ricardo Leitner +Acked-by: Neil Horman +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/sctp/protocol.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +--- a/net/sctp/protocol.c ++++ b/net/sctp/protocol.c +@@ -508,22 +508,20 @@ static void sctp_v4_get_dst(struct sctp_ + if (IS_ERR(rt)) + continue; + +- if (!dst) +- dst = &rt->dst; +- + /* Ensure the src address belongs to the output + * interface. + */ + odev = __ip_dev_find(sock_net(sk), laddr->a.v4.sin_addr.s_addr, + false); + if (!odev || odev->ifindex != fl4->flowi4_oif) { +- if (&rt->dst != dst) ++ if (!dst) ++ dst = &rt->dst; ++ else + dst_release(&rt->dst); + continue; + } + +- if (dst != &rt->dst) +- dst_release(dst); ++ dst_release(dst); + dst = &rt->dst; + break; + } diff --git a/queue-4.4/sctp-fix-dst-refcnt-leak-in-sctp_v6_get_dst.patch b/queue-4.4/sctp-fix-dst-refcnt-leak-in-sctp_v6_get_dst.patch new file mode 100644 index 00000000000..6c2e2827bb2 --- /dev/null +++ b/queue-4.4/sctp-fix-dst-refcnt-leak-in-sctp_v6_get_dst.patch @@ -0,0 +1,57 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Alexey Kodanev +Date: Mon, 5 Feb 2018 15:10:35 +0300 +Subject: sctp: fix dst refcnt leak in sctp_v6_get_dst() + +From: Alexey Kodanev + + +[ Upstream commit 957d761cf91cdbb175ad7d8f5472336a4d54dbf2 ] + +When going through the bind address list in sctp_v6_get_dst() and +the previously found address is better ('matchlen > bmatchlen'), +the code continues to the next iteration without releasing currently +held destination. + +Fix it by releasing 'bdst' before continue to the next iteration, and +instead of introducing one more '!IS_ERR(bdst)' check for dst_release(), +move the already existed one right after ip6_dst_lookup_flow(), i.e. we +shouldn't proceed further if we get an error for the route lookup. + +Fixes: dbc2b5e9a09e ("sctp: fix src address selection if using secondary addresses for ipv6") +Signed-off-by: Alexey Kodanev +Acked-by: Neil Horman +Acked-by: Marcelo Ricardo Leitner +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/sctp/ipv6.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +--- a/net/sctp/ipv6.c ++++ b/net/sctp/ipv6.c +@@ -323,8 +323,10 @@ static void sctp_v6_get_dst(struct sctp_ + final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); + bdst = ip6_dst_lookup_flow(sk, fl6, final_p); + +- if (!IS_ERR(bdst) && +- ipv6_chk_addr(dev_net(bdst->dev), ++ if (IS_ERR(bdst)) ++ continue; ++ ++ if (ipv6_chk_addr(dev_net(bdst->dev), + &laddr->a.v6.sin6_addr, bdst->dev, 1)) { + if (!IS_ERR_OR_NULL(dst)) + dst_release(dst); +@@ -333,8 +335,10 @@ static void sctp_v6_get_dst(struct sctp_ + } + + bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a); +- if (matchlen > bmatchlen) ++ if (matchlen > bmatchlen) { ++ dst_release(bdst); + continue; ++ } + + if (!IS_ERR_OR_NULL(dst)) + dst_release(dst); diff --git a/queue-4.4/sctp-verify-size-of-a-new-chunk-in-_sctp_make_chunk.patch b/queue-4.4/sctp-verify-size-of-a-new-chunk-in-_sctp_make_chunk.patch new file mode 100644 index 00000000000..a7e1320761f --- /dev/null +++ b/queue-4.4/sctp-verify-size-of-a-new-chunk-in-_sctp_make_chunk.patch @@ -0,0 +1,87 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Alexey Kodanev +Date: Fri, 9 Feb 2018 17:35:23 +0300 +Subject: sctp: verify size of a new chunk in _sctp_make_chunk() + +From: Alexey Kodanev + + +[ Upstream commit 07f2c7ab6f8d0a7e7c5764c4e6cc9c52951b9d9c ] + +When SCTP makes INIT or INIT_ACK packet the total chunk length +can exceed SCTP_MAX_CHUNK_LEN which leads to kernel panic when +transmitting these packets, e.g. the crash on sending INIT_ACK: + +[ 597.804948] skbuff: skb_over_panic: text:00000000ffae06e4 len:120168 + put:120156 head:000000007aa47635 data:00000000d991c2de + tail:0x1d640 end:0xfec0 dev: +... +[ 597.976970] ------------[ cut here ]------------ +[ 598.033408] kernel BUG at net/core/skbuff.c:104! +[ 600.314841] Call Trace: +[ 600.345829] +[ 600.371639] ? sctp_packet_transmit+0x2095/0x26d0 [sctp] +[ 600.436934] skb_put+0x16c/0x200 +[ 600.477295] sctp_packet_transmit+0x2095/0x26d0 [sctp] +[ 600.540630] ? sctp_packet_config+0x890/0x890 [sctp] +[ 600.601781] ? __sctp_packet_append_chunk+0x3b4/0xd00 [sctp] +[ 600.671356] ? sctp_cmp_addr_exact+0x3f/0x90 [sctp] +[ 600.731482] sctp_outq_flush+0x663/0x30d0 [sctp] +[ 600.788565] ? sctp_make_init+0xbf0/0xbf0 [sctp] +[ 600.845555] ? sctp_check_transmitted+0x18f0/0x18f0 [sctp] +[ 600.912945] ? sctp_outq_tail+0x631/0x9d0 [sctp] +[ 600.969936] sctp_cmd_interpreter.isra.22+0x3be1/0x5cb0 [sctp] +[ 601.041593] ? sctp_sf_do_5_1B_init+0x85f/0xc30 [sctp] +[ 601.104837] ? sctp_generate_t1_cookie_event+0x20/0x20 [sctp] +[ 601.175436] ? sctp_eat_data+0x1710/0x1710 [sctp] +[ 601.233575] sctp_do_sm+0x182/0x560 [sctp] +[ 601.284328] ? sctp_has_association+0x70/0x70 [sctp] +[ 601.345586] ? sctp_rcv+0xef4/0x32f0 [sctp] +[ 601.397478] ? sctp6_rcv+0xa/0x20 [sctp] +... + +Here the chunk size for INIT_ACK packet becomes too big, mostly +because of the state cookie (INIT packet has large size with +many address parameters), plus additional server parameters. + +Later this chunk causes the panic in skb_put_data(): + + skb_packet_transmit() + sctp_packet_pack() + skb_put_data(nskb, chunk->skb->data, chunk->skb->len); + +'nskb' (head skb) was previously allocated with packet->size +from u16 'chunk->chunk_hdr->length'. + +As suggested by Marcelo we should check the chunk's length in +_sctp_make_chunk() before trying to allocate skb for it and +discard a chunk if its size bigger than SCTP_MAX_CHUNK_LEN. + +Signed-off-by: Alexey Kodanev +Acked-by: Marcelo Ricardo Leitner +Acked-by: Neil Horman +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/sctp/sm_make_chunk.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/net/sctp/sm_make_chunk.c ++++ b/net/sctp/sm_make_chunk.c +@@ -1367,10 +1367,14 @@ static struct sctp_chunk *_sctp_make_chu + sctp_chunkhdr_t *chunk_hdr; + struct sk_buff *skb; + struct sock *sk; ++ int chunklen; ++ ++ chunklen = sizeof(*chunk_hdr) + paylen; ++ if (chunklen > SCTP_MAX_CHUNK_LEN) ++ goto nodata; + + /* No need to allocate LL here, as this is only a chunk. */ +- skb = alloc_skb(WORD_ROUND(sizeof(sctp_chunkhdr_t) + paylen), +- GFP_ATOMIC); ++ skb = alloc_skb(chunklen, GFP_ATOMIC); + if (!skb) + goto nodata; + diff --git a/queue-4.4/series b/queue-4.4/series index abe73597be5..6766ceee813 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -15,3 +15,17 @@ x86-apic-vector-handle-legacy-irq-data-correctly.patch leds-do-not-overflow-sysfs-buffer-in-led_trigger_show.patch x86-spectre-fix-an-error-message.patch revert-led-core-fix-brightness-setting-when-setting-delay_off-0.patch +bridge-check-brport-attr-show-in-brport_show.patch +fib_semantics-don-t-match-route-with-mismatching-tclassid.patch +hdlc_ppp-carrier-detect-ok-don-t-turn-off-negotiation.patch +ipv6-sit-work-around-bogus-gcc-8-wrestrict-warning.patch +net-fix-race-on-decreasing-number-of-tx-queues.patch +net-ipv4-don-t-allow-setting-net.ipv4.route.min_pmtu-below-68.patch +netlink-ensure-to-loop-over-all-netns-in-genlmsg_multicast_allns.patch +ppp-prevent-unregistered-channels-from-connecting-to-ppp-units.patch +udplite-fix-partial-checksum-initialization.patch +sctp-fix-dst-refcnt-leak-in-sctp_v4_get_dst.patch +sctp-fix-dst-refcnt-leak-in-sctp_v6_get_dst.patch +s390-qeth-fix-setip-command-handling.patch +s390-qeth-fix-ipa-command-submission-race.patch +sctp-verify-size-of-a-new-chunk-in-_sctp_make_chunk.patch diff --git a/queue-4.4/udplite-fix-partial-checksum-initialization.patch b/queue-4.4/udplite-fix-partial-checksum-initialization.patch new file mode 100644 index 00000000000..0d5329749d2 --- /dev/null +++ b/queue-4.4/udplite-fix-partial-checksum-initialization.patch @@ -0,0 +1,76 @@ +From foo@baz Thu Mar 8 10:22:29 PST 2018 +From: Alexey Kodanev +Date: Thu, 15 Feb 2018 20:18:43 +0300 +Subject: udplite: fix partial checksum initialization + +From: Alexey Kodanev + + +[ Upstream commit 15f35d49c93f4fa9875235e7bf3e3783d2dd7a1b ] + +Since UDP-Lite is always using checksum, the following path is +triggered when calculating pseudo header for it: + + udp4_csum_init() or udp6_csum_init() + skb_checksum_init_zero_check() + __skb_checksum_validate_complete() + +The problem can appear if skb->len is less than CHECKSUM_BREAK. In +this particular case __skb_checksum_validate_complete() also invokes +__skb_checksum_complete(skb). If UDP-Lite is using partial checksum +that covers only part of a packet, the function will return bad +checksum and the packet will be dropped. + +It can be fixed if we skip skb_checksum_init_zero_check() and only +set the required pseudo header checksum for UDP-Lite with partial +checksum before udp4_csum_init()/udp6_csum_init() functions return. + +Fixes: ed70fcfcee95 ("net: Call skb_checksum_init in IPv4") +Fixes: e4f45b7f40bd ("net: Call skb_checksum_init in IPv6") +Signed-off-by: Alexey Kodanev +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + include/net/udplite.h | 1 + + net/ipv4/udp.c | 5 +++++ + net/ipv6/ip6_checksum.c | 5 +++++ + 3 files changed, 11 insertions(+) + +--- a/include/net/udplite.h ++++ b/include/net/udplite.h +@@ -62,6 +62,7 @@ static inline int udplite_checksum_init( + UDP_SKB_CB(skb)->cscov = cscov; + if (skb->ip_summed == CHECKSUM_COMPLETE) + skb->ip_summed = CHECKSUM_NONE; ++ skb->csum_valid = 0; + } + + return 0; +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -1744,6 +1744,11 @@ static inline int udp4_csum_init(struct + err = udplite_checksum_init(skb, uh); + if (err) + return err; ++ ++ if (UDP_SKB_CB(skb)->partial_cov) { ++ skb->csum = inet_compute_pseudo(skb, proto); ++ return 0; ++ } + } + + return skb_checksum_init_zero_check(skb, proto, uh->check, +--- a/net/ipv6/ip6_checksum.c ++++ b/net/ipv6/ip6_checksum.c +@@ -73,6 +73,11 @@ int udp6_csum_init(struct sk_buff *skb, + err = udplite_checksum_init(skb, uh); + if (err) + return err; ++ ++ if (UDP_SKB_CB(skb)->partial_cov) { ++ skb->csum = ip6_compute_pseudo(skb, proto); ++ return 0; ++ } + } + + /* To support RFC 6936 (allow zero checksum in UDP/IPV6 for tunnels)