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

1) Setting link attributes can modify the size of the attributes that
would be reported on a subsequent getlink netlink operation,
therefore min_ifinfo_dump_size needs to be adjusted. From Stefan
Gula.

2) Resegmentation of TSO frames while trimming can violate invariants
expected by callers, namely that the number of segments can only stay
the same or decrease, never increase. If MSS changes, however, we
can trim data but then end up with more segments. Fix this by only
segmenting to the MSS already recorded in the SKB. That's the
simplest fix for now and if we want to get more fancy in the future
that's a more involved change.

This probably explains some retransmit counter inaccuracies.

From Neal Cardwell.

3) Fix too-many-wakeups in POLL with AF_UNIX sockets, from Eric Dumazet.

4) Fix CAIF crashes wrt. namespace handling. From Eric Dumazet and
Eric W. Biederman.

5) TCP port selection fixes from Flavio Leitner.

6) More socket memory cgroup build fixes in certain randonfig
situations. From Glauber Costa.

7) Fix TCP memory sysctl regression reported by Ingo Molnar, also from
Glauber Costa.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
af_unix: fix EPOLLET regression for stream sockets
tcp: fix tcp_trim_head() to adjust segment count with skb MSS
net/tcp: Fix tcp memory limits initialization when !CONFIG_SYSCTL
net caif: Register properly as a pernet subsystem.
netns: Fail conspicously if someone uses net_generic at an inappropriate time.
net: explicitly add jump_label.h header to sock.h
net: RTNETLINK adjusting values of min_ifinfo_dump_size
ipv6: Fix ip_gre lockless xmits.
xen-netfront: correct MAX_TX_TARGET calculation.
netns: fix net_alloc_generic()
tcp: bind() optimize port allocation
tcp: bind() fix autoselection to share ports
l2tp: l2tp_ip - fix possible oops on packet receive
iwlwifi: fix PCI-E transport "inta" race
mac80211: set bss_conf.idle when vif is connected
mac80211: update oper_channel on ibss join

+59 -68
+2 -2
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
··· 972 972 } 973 973 #endif 974 974 975 - spin_unlock_irqrestore(&trans->shrd->lock, flags); 976 - 977 975 /* saved interrupt in inta variable now we can reset trans_pcie->inta */ 978 976 trans_pcie->inta = 0; 977 + 978 + spin_unlock_irqrestore(&trans->shrd->lock, flags); 979 979 980 980 /* Now service all interrupt bits discovered above. */ 981 981 if (inta & CSR_INT_BIT_HW_ERR) {
+1 -1
drivers/net/xen-netfront.c
··· 68 68 69 69 #define NET_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, PAGE_SIZE) 70 70 #define NET_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE) 71 - #define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) 71 + #define TX_MAX_TARGET min_t(int, NET_TX_RING_SIZE, 256) 72 72 73 73 struct netfront_stats { 74 74 u64 rx_packets;
+1
include/net/netns/generic.h
··· 41 41 ptr = ng->ptr[id - 1]; 42 42 rcu_read_unlock(); 43 43 44 + BUG_ON(!ptr); 44 45 return ptr; 45 46 } 46 47 #endif
+1
include/net/sock.h
··· 55 55 #include <linux/uaccess.h> 56 56 #include <linux/memcontrol.h> 57 57 #include <linux/res_counter.h> 58 + #include <linux/jump_label.h> 58 59 59 60 #include <linux/filter.h> 60 61 #include <linux/rculist_nulls.h>
+2
include/net/tcp.h
··· 311 311 #define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 312 312 #define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 313 313 314 + extern void tcp_init_mem(struct net *net); 315 + 314 316 extern void tcp_v4_err(struct sk_buff *skb, u32); 315 317 316 318 extern void tcp_shutdown (struct sock *sk, int how);
+2 -20
net/caif/caif_dev.c
··· 59 59 { 60 60 struct caif_net *caifn; 61 61 caifn = net_generic(net, caif_net_id); 62 - if (!caifn) 63 - return NULL; 64 62 return caifn->cfg; 65 63 } 66 64 EXPORT_SYMBOL(get_cfcnfg); ··· 67 69 { 68 70 struct caif_net *caifn; 69 71 caifn = net_generic(net, caif_net_id); 70 - if (!caifn) 71 - return NULL; 72 72 return &caifn->caifdevs; 73 73 } 74 74 ··· 95 99 struct caif_device_entry *caifd; 96 100 97 101 caifdevs = caif_device_list(dev_net(dev)); 98 - if (!caifdevs) 99 - return NULL; 100 102 101 103 caifd = kzalloc(sizeof(*caifd), GFP_KERNEL); 102 104 if (!caifd) ··· 114 120 struct caif_device_entry_list *caifdevs = 115 121 caif_device_list(dev_net(dev)); 116 122 struct caif_device_entry *caifd; 117 - if (!caifdevs) 118 - return NULL; 119 123 120 124 list_for_each_entry_rcu(caifd, &caifdevs->list, list) { 121 125 if (caifd->netdev == dev) ··· 313 321 struct caif_device_entry_list *caifdevs; 314 322 315 323 caifdevs = caif_device_list(dev_net(dev)); 316 - if (!cfg || !caifdevs) 317 - return; 318 324 caifd = caif_device_alloc(dev); 319 325 if (!caifd) 320 326 return; ··· 364 374 365 375 cfg = get_cfcnfg(dev_net(dev)); 366 376 caifdevs = caif_device_list(dev_net(dev)); 367 - if (!cfg || !caifdevs) 368 - return 0; 369 377 370 378 caifd = caif_get(dev); 371 379 if (caifd == NULL && dev->type != ARPHRD_CAIF) ··· 495 507 static int caif_init_net(struct net *net) 496 508 { 497 509 struct caif_net *caifn = net_generic(net, caif_net_id); 498 - if (WARN_ON(!caifn)) 499 - return -EINVAL; 500 - 501 510 INIT_LIST_HEAD(&caifn->caifdevs.list); 502 511 mutex_init(&caifn->caifdevs.lock); 503 512 ··· 511 526 struct caif_device_entry_list *caifdevs = 512 527 caif_device_list(net); 513 528 struct cfcnfg *cfg = get_cfcnfg(net); 514 - 515 - if (!cfg || !caifdevs) 516 - return; 517 529 518 530 rtnl_lock(); 519 531 mutex_lock(&caifdevs->lock); ··· 551 569 { 552 570 int result; 553 571 554 - result = register_pernet_device(&caif_net_ops); 572 + result = register_pernet_subsys(&caif_net_ops); 555 573 556 574 if (result) 557 575 return result; ··· 564 582 565 583 static void __exit caif_device_exit(void) 566 584 { 567 - unregister_pernet_device(&caif_net_ops); 585 + unregister_pernet_subsys(&caif_net_ops); 568 586 unregister_netdevice_notifier(&caif_device_notifier); 569 587 dev_remove_pack(&caif_packet_type); 570 588 }
-1
net/caif/cfcnfg.c
··· 309 309 int err; 310 310 struct cfctrl_link_param param; 311 311 struct cfcnfg *cfg = get_cfcnfg(net); 312 - caif_assert(cfg != NULL); 313 312 314 313 rcu_read_lock(); 315 314 err = caif_connect_req_to_link_param(cfg, conn_req, &param);
+16 -15
net/core/net_namespace.c
··· 30 30 31 31 #define INITIAL_NET_GEN_PTRS 13 /* +1 for len +2 for rcu_head */ 32 32 33 + static unsigned int max_gen_ptrs = INITIAL_NET_GEN_PTRS; 34 + 35 + static struct net_generic *net_alloc_generic(void) 36 + { 37 + struct net_generic *ng; 38 + size_t generic_size = offsetof(struct net_generic, ptr[max_gen_ptrs]); 39 + 40 + ng = kzalloc(generic_size, GFP_KERNEL); 41 + if (ng) 42 + ng->len = max_gen_ptrs; 43 + 44 + return ng; 45 + } 46 + 33 47 static int net_assign_generic(struct net *net, int id, void *data) 34 48 { 35 49 struct net_generic *ng, *old_ng; ··· 57 43 if (old_ng->len >= id) 58 44 goto assign; 59 45 60 - ng = kzalloc(sizeof(struct net_generic) + 61 - id * sizeof(void *), GFP_KERNEL); 46 + ng = net_alloc_generic(); 62 47 if (ng == NULL) 63 48 return -ENOMEM; 64 49 ··· 72 59 * the old copy for kfree after a grace period. 73 60 */ 74 61 75 - ng->len = id; 76 62 memcpy(&ng->ptr, &old_ng->ptr, old_ng->len * sizeof(void*)); 77 63 78 64 rcu_assign_pointer(net->gen, ng); ··· 173 161 goto out; 174 162 } 175 163 176 - static struct net_generic *net_alloc_generic(void) 177 - { 178 - struct net_generic *ng; 179 - size_t generic_size = sizeof(struct net_generic) + 180 - INITIAL_NET_GEN_PTRS * sizeof(void *); 181 - 182 - ng = kzalloc(generic_size, GFP_KERNEL); 183 - if (ng) 184 - ng->len = INITIAL_NET_GEN_PTRS; 185 - 186 - return ng; 187 - } 188 164 189 165 #ifdef CONFIG_NET_NS 190 166 static struct kmem_cache *net_cachep; ··· 483 483 } 484 484 return error; 485 485 } 486 + max_gen_ptrs = max_t(unsigned int, max_gen_ptrs, *ops->id); 486 487 } 487 488 error = __register_pernet_operations(list, ops); 488 489 if (error) {
+3
net/core/rtnetlink.c
··· 1509 1509 1510 1510 if (send_addr_notify) 1511 1511 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); 1512 + min_ifinfo_dump_size = max_t(u16, if_nlmsg_size(dev), 1513 + min_ifinfo_dump_size); 1514 + 1512 1515 return err; 1513 1516 } 1514 1517
+5 -2
net/ipv4/inet_connection_sock.c
··· 123 123 smallest_size = tb->num_owners; 124 124 smallest_rover = rover; 125 125 if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) { 126 - spin_unlock(&head->lock); 127 126 snum = smallest_rover; 128 - goto have_snum; 127 + goto tb_found; 129 128 } 129 + } 130 + if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) { 131 + snum = rover; 132 + goto tb_found; 130 133 } 131 134 goto next; 132 135 }
+4
net/ipv4/ip_gre.c
··· 422 422 if (register_netdevice(dev) < 0) 423 423 goto failed_free; 424 424 425 + /* Can use a lockless transmit, unless we generate output sequences */ 426 + if (!(nt->parms.o_flags & GRE_SEQ)) 427 + dev->features |= NETIF_F_LLTX; 428 + 425 429 dev_hold(dev); 426 430 ipgre_tunnel_link(ign, nt); 427 431 return nt;
+1
net/ipv4/sysctl_net_ipv4.c
··· 814 814 815 815 net->ipv4.sysctl_rt_cache_rebuild_count = 4; 816 816 817 + tcp_init_mem(net); 817 818 limit = nr_free_buffer_pages() / 8; 818 819 limit = max(limit, 128UL); 819 820 net->ipv4.sysctl_tcp_mem[0] = limit / 4 * 3;
+13 -3
net/ipv4/tcp.c
··· 3216 3216 } 3217 3217 __setup("thash_entries=", set_thash_entries); 3218 3218 3219 + void tcp_init_mem(struct net *net) 3220 + { 3221 + /* Set per-socket limits to no more than 1/128 the pressure threshold */ 3222 + unsigned long limit = nr_free_buffer_pages() / 8; 3223 + limit = max(limit, 128UL); 3224 + net->ipv4.sysctl_tcp_mem[0] = limit / 4 * 3; 3225 + net->ipv4.sysctl_tcp_mem[1] = limit; 3226 + net->ipv4.sysctl_tcp_mem[2] = net->ipv4.sysctl_tcp_mem[0] * 2; 3227 + } 3228 + 3219 3229 void __init tcp_init(void) 3220 3230 { 3221 3231 struct sk_buff *skb = NULL; ··· 3286 3276 sysctl_tcp_max_orphans = cnt / 2; 3287 3277 sysctl_max_syn_backlog = max(128, cnt / 256); 3288 3278 3289 - /* Set per-socket limits to no more than 1/128 the pressure threshold */ 3290 - limit = ((unsigned long)init_net.ipv4.sysctl_tcp_mem[1]) 3291 - << (PAGE_SHIFT - 7); 3279 + tcp_init_mem(&init_net); 3280 + limit = nr_free_buffer_pages() / 8; 3281 + limit = max(limit, 128UL); 3292 3282 max_share = min(4UL*1024*1024, limit); 3293 3283 3294 3284 sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
+2 -4
net/ipv4/tcp_output.c
··· 1141 1141 sk_mem_uncharge(sk, len); 1142 1142 sock_set_flag(sk, SOCK_QUEUE_SHRUNK); 1143 1143 1144 - /* Any change of skb->len requires recalculation of tso 1145 - * factor and mss. 1146 - */ 1144 + /* Any change of skb->len requires recalculation of tso factor. */ 1147 1145 if (tcp_skb_pcount(skb) > 1) 1148 - tcp_set_skb_tso_segs(sk, skb, tcp_current_mss(sk)); 1146 + tcp_set_skb_tso_segs(sk, skb, tcp_skb_mss(skb)); 1149 1147 1150 1148 return 0; 1151 1149 }
-5
net/l2tp/l2tp_ip.c
··· 393 393 { 394 394 int rc; 395 395 396 - if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) 397 - goto drop; 398 - 399 - nf_reset(skb); 400 - 401 396 /* Charge it to the socket, dropping if the queue is full. */ 402 397 rc = sock_queue_rcv_skb(sk, skb); 403 398 if (rc < 0)
+1
net/mac80211/ibss.c
··· 106 106 107 107 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; 108 108 109 + local->oper_channel = chan; 109 110 channel_type = ifibss->channel_type; 110 111 if (channel_type > NL80211_CHAN_HT20 && 111 112 !cfg80211_can_beacon_sec_chan(local->hw.wiphy, chan, channel_type))
+1
net/mac80211/iface.c
··· 1314 1314 continue; 1315 1315 } 1316 1316 /* count everything else */ 1317 + sdata->vif.bss_conf.idle = false; 1317 1318 count++; 1318 1319 } 1319 1320
+4 -15
net/unix/af_unix.c
··· 1918 1918 struct sk_buff *skb; 1919 1919 1920 1920 unix_state_lock(sk); 1921 - skb = skb_dequeue(&sk->sk_receive_queue); 1921 + skb = skb_peek(&sk->sk_receive_queue); 1922 1922 if (skb == NULL) { 1923 1923 unix_sk(sk)->recursion_level = 0; 1924 1924 if (copied >= target) ··· 1958 1958 if (check_creds) { 1959 1959 /* Never glue messages from different writers */ 1960 1960 if ((UNIXCB(skb).pid != siocb->scm->pid) || 1961 - (UNIXCB(skb).cred != siocb->scm->cred)) { 1962 - skb_queue_head(&sk->sk_receive_queue, skb); 1963 - sk->sk_data_ready(sk, skb->len); 1961 + (UNIXCB(skb).cred != siocb->scm->cred)) 1964 1962 break; 1965 - } 1966 1963 } else { 1967 1964 /* Copy credentials */ 1968 1965 scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred); ··· 1974 1977 1975 1978 chunk = min_t(unsigned int, skb->len, size); 1976 1979 if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { 1977 - skb_queue_head(&sk->sk_receive_queue, skb); 1978 - sk->sk_data_ready(sk, skb->len); 1979 1980 if (copied == 0) 1980 1981 copied = -EFAULT; 1981 1982 break; ··· 1988 1993 if (UNIXCB(skb).fp) 1989 1994 unix_detach_fds(siocb->scm, skb); 1990 1995 1991 - /* put the skb back if we didn't use it up.. */ 1992 - if (skb->len) { 1993 - skb_queue_head(&sk->sk_receive_queue, skb); 1994 - sk->sk_data_ready(sk, skb->len); 1996 + if (skb->len) 1995 1997 break; 1996 - } 1997 1998 1999 + skb_unlink(skb, &sk->sk_receive_queue); 1998 2000 consume_skb(skb); 1999 2001 2000 2002 if (siocb->scm->fp) ··· 2002 2010 if (UNIXCB(skb).fp) 2003 2011 siocb->scm->fp = scm_fp_dup(UNIXCB(skb).fp); 2004 2012 2005 - /* put message back and return */ 2006 - skb_queue_head(&sk->sk_receive_queue, skb); 2007 - sk->sk_data_ready(sk, skb->len); 2008 2013 break; 2009 2014 } 2010 2015 } while (size);