Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

1) The per-network-namespace loopback device, and thus its namespace,
can have its teardown deferred for a long time if a kernel created
TCP socket closes and the namespace is exiting meanwhile. The kernel
keeps trying to finish the close sequence until it times out (which
takes quite some time).

Fix this by forcing the socket closed in this situation, from Dan
Streetman.

2) Fix regression where we're trying to invoke the update_pmtu method
on route types (in this case metadata tunnel routes) that don't
implement the dst_ops method. Fix from Nicolas Dichtel.

3) Fix long standing memory corruption issues in r8169 driver by
performing the chip statistics DMA programming more correctly. From
Francois Romieu.

4) Handle local broadcast sends over VRF routes properly, from David
Ahern.

5) Don't refire the DCCP CCID2 timer endlessly, otherwise the socket
can never be released. From Alexey Kodanev.

6) Set poll flags properly in VSOCK protocol layer, from Stefan
Hajnoczi.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
VSOCK: set POLLOUT | POLLWRNORM for TCP_CLOSING
dccp: don't restart ccid2_hc_tx_rto_expire() if sk in closed state
net: vrf: Add support for sends to local broadcast address
r8169: fix memory corruption on retrieval of hardware statistics.
net: don't call update_pmtu unconditionally
net: tcp: close sock if net namespace is exiting

+57 -28
+1 -2
drivers/infiniband/ulp/ipoib/ipoib_cm.c
··· 1456 1456 struct ipoib_dev_priv *priv = ipoib_priv(dev); 1457 1457 int e = skb_queue_empty(&priv->cm.skb_queue); 1458 1458 1459 - if (skb_dst(skb)) 1460 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); 1459 + skb_dst_update_pmtu(skb, mtu); 1461 1460 1462 1461 skb_queue_tail(&priv->cm.skb_queue, skb); 1463 1462 if (e)
+2 -7
drivers/net/ethernet/realtek/r8169.c
··· 2244 2244 void __iomem *ioaddr = tp->mmio_addr; 2245 2245 dma_addr_t paddr = tp->counters_phys_addr; 2246 2246 u32 cmd; 2247 - bool ret; 2248 2247 2249 2248 RTL_W32(CounterAddrHigh, (u64)paddr >> 32); 2249 + RTL_R32(CounterAddrHigh); 2250 2250 cmd = (u64)paddr & DMA_BIT_MASK(32); 2251 2251 RTL_W32(CounterAddrLow, cmd); 2252 2252 RTL_W32(CounterAddrLow, cmd | counter_cmd); 2253 2253 2254 - ret = rtl_udelay_loop_wait_low(tp, &rtl_counters_cond, 10, 1000); 2255 - 2256 - RTL_W32(CounterAddrLow, 0); 2257 - RTL_W32(CounterAddrHigh, 0); 2258 - 2259 - return ret; 2254 + return rtl_udelay_loop_wait_low(tp, &rtl_counters_cond, 10, 1000); 2260 2255 } 2261 2256 2262 2257 static bool rtl8169_reset_counters(struct net_device *dev)
+2 -2
drivers/net/geneve.c
··· 829 829 int mtu = dst_mtu(&rt->dst) - sizeof(struct iphdr) - 830 830 GENEVE_BASE_HLEN - info->options_len - 14; 831 831 832 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); 832 + skb_dst_update_pmtu(skb, mtu); 833 833 } 834 834 835 835 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); ··· 875 875 int mtu = dst_mtu(dst) - sizeof(struct ipv6hdr) - 876 876 GENEVE_BASE_HLEN - info->options_len - 14; 877 877 878 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); 878 + skb_dst_update_pmtu(skb, mtu); 879 879 } 880 880 881 881 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
+3 -2
drivers/net/vrf.c
··· 673 673 struct sock *sk, 674 674 struct sk_buff *skb) 675 675 { 676 - /* don't divert multicast */ 677 - if (ipv4_is_multicast(ip_hdr(skb)->daddr)) 676 + /* don't divert multicast or local broadcast */ 677 + if (ipv4_is_multicast(ip_hdr(skb)->daddr) || 678 + ipv4_is_lbcast(ip_hdr(skb)->daddr)) 678 679 return skb; 679 680 680 681 if (qdisc_tx_is_default(vrf_dev))
+2 -4
drivers/net/vxlan.c
··· 2158 2158 if (skb_dst(skb)) { 2159 2159 int mtu = dst_mtu(ndst) - VXLAN_HEADROOM; 2160 2160 2161 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, 2162 - skb, mtu); 2161 + skb_dst_update_pmtu(skb, mtu); 2163 2162 } 2164 2163 2165 2164 tos = ip_tunnel_ecn_encap(tos, old_iph, skb); ··· 2199 2200 if (skb_dst(skb)) { 2200 2201 int mtu = dst_mtu(ndst) - VXLAN6_HEADROOM; 2201 2202 2202 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, 2203 - skb, mtu); 2203 + skb_dst_update_pmtu(skb, mtu); 2204 2204 } 2205 2205 2206 2206 tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
+8
include/net/dst.h
··· 521 521 } 522 522 #endif 523 523 524 + static inline void skb_dst_update_pmtu(struct sk_buff *skb, u32 mtu) 525 + { 526 + struct dst_entry *dst = skb_dst(skb); 527 + 528 + if (dst && dst->ops->update_pmtu) 529 + dst->ops->update_pmtu(dst, NULL, skb, mtu); 530 + } 531 + 524 532 #endif /* _NET_DST_H */
+10
include/net/net_namespace.h
··· 223 223 return net1 == net2; 224 224 } 225 225 226 + static inline int check_net(const struct net *net) 227 + { 228 + return atomic_read(&net->count) != 0; 229 + } 230 + 226 231 void net_drop_ns(void *); 227 232 228 233 #else ··· 248 243 249 244 static inline 250 245 int net_eq(const struct net *net1, const struct net *net2) 246 + { 247 + return 1; 248 + } 249 + 250 + static inline int check_net(const struct net *net) 251 251 { 252 252 return 1; 253 253 }
+3
net/dccp/ccids/ccid2.c
··· 140 140 141 141 ccid2_pr_debug("RTO_EXPIRE\n"); 142 142 143 + if (sk->sk_state == DCCP_CLOSED) 144 + goto out; 145 + 143 146 /* back-off timer */ 144 147 hc->tx_rto <<= 1; 145 148 if (hc->tx_rto > DCCP_RTO_MAX)
+1 -2
net/ipv4/ip_tunnel.c
··· 520 520 else 521 521 mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; 522 522 523 - if (skb_dst(skb)) 524 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); 523 + skb_dst_update_pmtu(skb, mtu); 525 524 526 525 if (skb->protocol == htons(ETH_P_IP)) { 527 526 if (!skb_is_gso(skb) &&
+1 -1
net/ipv4/ip_vti.c
··· 200 200 201 201 mtu = dst_mtu(dst); 202 202 if (skb->len > mtu) { 203 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); 203 + skb_dst_update_pmtu(skb, mtu); 204 204 if (skb->protocol == htons(ETH_P_IP)) { 205 205 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, 206 206 htonl(mtu));
+3
net/ipv4/tcp.c
··· 2298 2298 tcp_send_active_reset(sk, GFP_ATOMIC); 2299 2299 __NET_INC_STATS(sock_net(sk), 2300 2300 LINUX_MIB_TCPABORTONMEMORY); 2301 + } else if (!check_net(sock_net(sk))) { 2302 + /* Not possible to send reset; just close */ 2303 + tcp_set_state(sk, TCP_CLOSE); 2301 2304 } 2302 2305 } 2303 2306
+15
net/ipv4/tcp_timer.c
··· 48 48 * to prevent DoS attacks. It is called when a retransmission timeout 49 49 * or zero probe timeout occurs on orphaned socket. 50 50 * 51 + * Also close if our net namespace is exiting; in that case there is no 52 + * hope of ever communicating again since all netns interfaces are already 53 + * down (or about to be down), and we need to release our dst references, 54 + * which have been moved to the netns loopback interface, so the namespace 55 + * can finish exiting. This condition is only possible if we are a kernel 56 + * socket, as those do not hold references to the namespace. 57 + * 51 58 * Criteria is still not confirmed experimentally and may change. 52 59 * We kill the socket, if: 53 60 * 1. If number of orphaned sockets exceeds an administratively configured 54 61 * limit. 55 62 * 2. If we have strong memory pressure. 63 + * 3. If our net namespace is exiting. 56 64 */ 57 65 static int tcp_out_of_resources(struct sock *sk, bool do_reset) 58 66 { ··· 89 81 __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONMEMORY); 90 82 return 1; 91 83 } 84 + 85 + if (!check_net(sock_net(sk))) { 86 + /* Not possible to send reset; just close */ 87 + tcp_done(sk); 88 + return 1; 89 + } 90 + 92 91 return 0; 93 92 } 94 93
+2 -4
net/ipv6/ip6_tunnel.c
··· 642 642 if (rel_info > dst_mtu(skb_dst(skb2))) 643 643 goto out; 644 644 645 - skb_dst(skb2)->ops->update_pmtu(skb_dst(skb2), NULL, skb2, 646 - rel_info); 645 + skb_dst_update_pmtu(skb2, rel_info); 647 646 } 648 647 649 648 icmp_send(skb2, rel_type, rel_code, htonl(rel_info)); ··· 1130 1131 mtu = 576; 1131 1132 } 1132 1133 1133 - if (skb_dst(skb) && !t->parms.collect_md) 1134 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); 1134 + skb_dst_update_pmtu(skb, mtu); 1135 1135 if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) { 1136 1136 *pmtu = mtu; 1137 1137 err = -EMSGSIZE;
+1 -1
net/ipv6/ip6_vti.c
··· 483 483 484 484 mtu = dst_mtu(dst); 485 485 if (!skb->ignore_df && skb->len > mtu) { 486 - skb_dst(skb)->ops->update_pmtu(dst, NULL, skb, mtu); 486 + skb_dst_update_pmtu(skb, mtu); 487 487 488 488 if (skb->protocol == htons(ETH_P_IPV6)) { 489 489 if (mtu < IPV6_MIN_MTU)
+2 -2
net/ipv6/sit.c
··· 934 934 df = 0; 935 935 } 936 936 937 - if (tunnel->parms.iph.daddr && skb_dst(skb)) 938 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); 937 + if (tunnel->parms.iph.daddr) 938 + skb_dst_update_pmtu(skb, mtu); 939 939 940 940 if (skb->len > mtu && !skb_is_gso(skb)) { 941 941 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
+1 -1
net/vmw_vsock/af_vsock.c
··· 951 951 * POLLOUT|POLLWRNORM when peer is closed and nothing to read, 952 952 * but local send is not shutdown. 953 953 */ 954 - if (sk->sk_state == TCP_CLOSE) { 954 + if (sk->sk_state == TCP_CLOSE || sk->sk_state == TCP_CLOSING) { 955 955 if (!(sk->sk_shutdown & SEND_SHUTDOWN)) 956 956 mask |= POLLOUT | POLLWRNORM; 957 957