diff options
author | David S. Miller <davem@davemloft.net> | 2015-03-09 23:38:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-09 23:38:02 -0400 |
commit | 3cef5c5b0b56f3f90b0e9ff8d3f8dc57f464cc14 (patch) | |
tree | 02e95f15bd8a04071a9a36f534a92a066a8ce66a /net | |
parent | 8ac467e837a24eb024177b4b01013d8e6764913a (diff) | |
parent | affb8172de395a6e1db52ed9790ca0456d8c29a9 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/ethernet/cadence/macb.c
Overlapping changes in macb driver, mostly fixes and cleanups
in 'net' overlapping with the integration of at91_ether into
macb in 'net-next'.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/can/af_can.c | 3 | ||||
-rw-r--r-- | net/ipv4/ip_fragment.c | 11 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 33 | ||||
-rw-r--r-- | net/ipv4/ping.c | 12 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 10 | ||||
-rw-r--r-- | net/ipv6/datagram.c | 39 | ||||
-rw-r--r-- | net/ipv6/ping.c | 5 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sync.c | 3 | ||||
-rw-r--r-- | net/netfilter/nf_tables_api.c | 61 | ||||
-rw-r--r-- | net/netfilter/nft_compat.c | 14 | ||||
-rw-r--r-- | net/packet/af_packet.c | 22 | ||||
-rw-r--r-- | net/rxrpc/ar-error.c | 4 | ||||
-rw-r--r-- | net/sunrpc/cache.c | 2 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/rpc_rdma.c | 3 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/xprt_rdma.h | 2 | ||||
-rw-r--r-- | net/tipc/link.c | 7 |
17 files changed, 150 insertions, 85 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c index 66e08040ced7..32d710eaf1fc 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -259,6 +259,9 @@ int can_send(struct sk_buff *skb, int loop) | |||
259 | goto inval_skb; | 259 | goto inval_skb; |
260 | } | 260 | } |
261 | 261 | ||
262 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
263 | |||
264 | skb_reset_mac_header(skb); | ||
262 | skb_reset_network_header(skb); | 265 | skb_reset_network_header(skb); |
263 | skb_reset_transport_header(skb); | 266 | skb_reset_transport_header(skb); |
264 | 267 | ||
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 2c8d98e728c0..145a50c4d566 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -659,27 +659,30 @@ EXPORT_SYMBOL(ip_defrag); | |||
659 | struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) | 659 | struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) |
660 | { | 660 | { |
661 | struct iphdr iph; | 661 | struct iphdr iph; |
662 | int netoff; | ||
662 | u32 len; | 663 | u32 len; |
663 | 664 | ||
664 | if (skb->protocol != htons(ETH_P_IP)) | 665 | if (skb->protocol != htons(ETH_P_IP)) |
665 | return skb; | 666 | return skb; |
666 | 667 | ||
667 | if (skb_copy_bits(skb, 0, &iph, sizeof(iph)) < 0) | 668 | netoff = skb_network_offset(skb); |
669 | |||
670 | if (skb_copy_bits(skb, netoff, &iph, sizeof(iph)) < 0) | ||
668 | return skb; | 671 | return skb; |
669 | 672 | ||
670 | if (iph.ihl < 5 || iph.version != 4) | 673 | if (iph.ihl < 5 || iph.version != 4) |
671 | return skb; | 674 | return skb; |
672 | 675 | ||
673 | len = ntohs(iph.tot_len); | 676 | len = ntohs(iph.tot_len); |
674 | if (skb->len < len || len < (iph.ihl * 4)) | 677 | if (skb->len < netoff + len || len < (iph.ihl * 4)) |
675 | return skb; | 678 | return skb; |
676 | 679 | ||
677 | if (ip_is_fragment(&iph)) { | 680 | if (ip_is_fragment(&iph)) { |
678 | skb = skb_share_check(skb, GFP_ATOMIC); | 681 | skb = skb_share_check(skb, GFP_ATOMIC); |
679 | if (skb) { | 682 | if (skb) { |
680 | if (!pskb_may_pull(skb, iph.ihl*4)) | 683 | if (!pskb_may_pull(skb, netoff + iph.ihl * 4)) |
681 | return skb; | 684 | return skb; |
682 | if (pskb_trim_rcsum(skb, len)) | 685 | if (pskb_trim_rcsum(skb, netoff + len)) |
683 | return skb; | 686 | return skb; |
684 | memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); | 687 | memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); |
685 | if (ip_defrag(skb, user)) | 688 | if (ip_defrag(skb, user)) |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 31d8c71986b4..5cd99271d3a6 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -432,17 +432,32 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf | |||
432 | kfree_skb(skb); | 432 | kfree_skb(skb); |
433 | } | 433 | } |
434 | 434 | ||
435 | static bool ipv4_pktinfo_prepare_errqueue(const struct sock *sk, | 435 | /* IPv4 supports cmsg on all imcp errors and some timestamps |
436 | const struct sk_buff *skb, | 436 | * |
437 | int ee_origin) | 437 | * Timestamp code paths do not initialize the fields expected by cmsg: |
438 | * the PKTINFO fields in skb->cb[]. Fill those in here. | ||
439 | */ | ||
440 | static bool ipv4_datagram_support_cmsg(const struct sock *sk, | ||
441 | struct sk_buff *skb, | ||
442 | int ee_origin) | ||
438 | { | 443 | { |
439 | struct in_pktinfo *info = PKTINFO_SKB_CB(skb); | 444 | struct in_pktinfo *info; |
445 | |||
446 | if (ee_origin == SO_EE_ORIGIN_ICMP) | ||
447 | return true; | ||
440 | 448 | ||
441 | if ((ee_origin != SO_EE_ORIGIN_TIMESTAMPING) || | 449 | if (ee_origin == SO_EE_ORIGIN_LOCAL) |
442 | (!(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_CMSG)) || | 450 | return false; |
451 | |||
452 | /* Support IP_PKTINFO on tstamp packets if requested, to correlate | ||
453 | * timestamp with egress dev. Not possible for packets without dev | ||
454 | * or without payload (SOF_TIMESTAMPING_OPT_TSONLY). | ||
455 | */ | ||
456 | if ((!(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_CMSG)) || | ||
443 | (!skb->dev)) | 457 | (!skb->dev)) |
444 | return false; | 458 | return false; |
445 | 459 | ||
460 | info = PKTINFO_SKB_CB(skb); | ||
446 | info->ipi_spec_dst.s_addr = ip_hdr(skb)->saddr; | 461 | info->ipi_spec_dst.s_addr = ip_hdr(skb)->saddr; |
447 | info->ipi_ifindex = skb->dev->ifindex; | 462 | info->ipi_ifindex = skb->dev->ifindex; |
448 | return true; | 463 | return true; |
@@ -483,7 +498,7 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) | |||
483 | 498 | ||
484 | serr = SKB_EXT_ERR(skb); | 499 | serr = SKB_EXT_ERR(skb); |
485 | 500 | ||
486 | if (sin && skb->len) { | 501 | if (sin && serr->port) { |
487 | sin->sin_family = AF_INET; | 502 | sin->sin_family = AF_INET; |
488 | sin->sin_addr.s_addr = *(__be32 *)(skb_network_header(skb) + | 503 | sin->sin_addr.s_addr = *(__be32 *)(skb_network_header(skb) + |
489 | serr->addr_offset); | 504 | serr->addr_offset); |
@@ -496,9 +511,7 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) | |||
496 | sin = &errhdr.offender; | 511 | sin = &errhdr.offender; |
497 | memset(sin, 0, sizeof(*sin)); | 512 | memset(sin, 0, sizeof(*sin)); |
498 | 513 | ||
499 | if (skb->len && | 514 | if (ipv4_datagram_support_cmsg(sk, skb, serr->ee.ee_origin)) { |
500 | (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP || | ||
501 | ipv4_pktinfo_prepare_errqueue(sk, skb, serr->ee.ee_origin))) { | ||
502 | sin->sin_family = AF_INET; | 515 | sin->sin_family = AF_INET; |
503 | sin->sin_addr.s_addr = ip_hdr(skb)->saddr; | 516 | sin->sin_addr.s_addr = ip_hdr(skb)->saddr; |
504 | if (inet_sk(sk)->cmsg_flags) | 517 | if (inet_sk(sk)->cmsg_flags) |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 3648e7f32f3d..fd88f868776f 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -259,6 +259,9 @@ int ping_init_sock(struct sock *sk) | |||
259 | kgid_t low, high; | 259 | kgid_t low, high; |
260 | int ret = 0; | 260 | int ret = 0; |
261 | 261 | ||
262 | if (sk->sk_family == AF_INET6) | ||
263 | sk->sk_ipv6only = 1; | ||
264 | |||
262 | inet_get_ping_group_range_net(net, &low, &high); | 265 | inet_get_ping_group_range_net(net, &low, &high); |
263 | if (gid_lte(low, group) && gid_lte(group, high)) | 266 | if (gid_lte(low, group) && gid_lte(group, high)) |
264 | return 0; | 267 | return 0; |
@@ -305,6 +308,11 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk, | |||
305 | if (addr_len < sizeof(*addr)) | 308 | if (addr_len < sizeof(*addr)) |
306 | return -EINVAL; | 309 | return -EINVAL; |
307 | 310 | ||
311 | if (addr->sin_family != AF_INET && | ||
312 | !(addr->sin_family == AF_UNSPEC && | ||
313 | addr->sin_addr.s_addr == htonl(INADDR_ANY))) | ||
314 | return -EAFNOSUPPORT; | ||
315 | |||
308 | pr_debug("ping_check_bind_addr(sk=%p,addr=%pI4,port=%d)\n", | 316 | pr_debug("ping_check_bind_addr(sk=%p,addr=%pI4,port=%d)\n", |
309 | sk, &addr->sin_addr.s_addr, ntohs(addr->sin_port)); | 317 | sk, &addr->sin_addr.s_addr, ntohs(addr->sin_port)); |
310 | 318 | ||
@@ -330,7 +338,7 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk, | |||
330 | return -EINVAL; | 338 | return -EINVAL; |
331 | 339 | ||
332 | if (addr->sin6_family != AF_INET6) | 340 | if (addr->sin6_family != AF_INET6) |
333 | return -EINVAL; | 341 | return -EAFNOSUPPORT; |
334 | 342 | ||
335 | pr_debug("ping_check_bind_addr(sk=%p,addr=%pI6c,port=%d)\n", | 343 | pr_debug("ping_check_bind_addr(sk=%p,addr=%pI6c,port=%d)\n", |
336 | sk, addr->sin6_addr.s6_addr, ntohs(addr->sin6_port)); | 344 | sk, addr->sin6_addr.s6_addr, ntohs(addr->sin6_port)); |
@@ -715,7 +723,7 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
715 | if (msg->msg_namelen < sizeof(*usin)) | 723 | if (msg->msg_namelen < sizeof(*usin)) |
716 | return -EINVAL; | 724 | return -EINVAL; |
717 | if (usin->sin_family != AF_INET) | 725 | if (usin->sin_family != AF_INET) |
718 | return -EINVAL; | 726 | return -EAFNOSUPPORT; |
719 | daddr = usin->sin_addr.s_addr; | 727 | daddr = usin->sin_addr.s_addr; |
720 | /* no remote port */ | 728 | /* no remote port */ |
721 | } else { | 729 | } else { |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index d939c35001f9..62f38428279a 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -835,17 +835,13 @@ static unsigned int tcp_xmit_size_goal(struct sock *sk, u32 mss_now, | |||
835 | int large_allowed) | 835 | int large_allowed) |
836 | { | 836 | { |
837 | struct tcp_sock *tp = tcp_sk(sk); | 837 | struct tcp_sock *tp = tcp_sk(sk); |
838 | u32 new_size_goal, size_goal, hlen; | 838 | u32 new_size_goal, size_goal; |
839 | 839 | ||
840 | if (!large_allowed || !sk_can_gso(sk)) | 840 | if (!large_allowed || !sk_can_gso(sk)) |
841 | return mss_now; | 841 | return mss_now; |
842 | 842 | ||
843 | /* Maybe we should/could use sk->sk_prot->max_header here ? */ | 843 | /* Note : tcp_tso_autosize() will eventually split this later */ |
844 | hlen = inet_csk(sk)->icsk_af_ops->net_header_len + | 844 | new_size_goal = sk->sk_gso_max_size - 1 - MAX_TCP_HEADER; |
845 | inet_csk(sk)->icsk_ext_hdr_len + | ||
846 | tp->tcp_header_len; | ||
847 | |||
848 | new_size_goal = sk->sk_gso_max_size - 1 - hlen; | ||
849 | new_size_goal = tcp_bound_to_half_wnd(tp, new_size_goal); | 845 | new_size_goal = tcp_bound_to_half_wnd(tp, new_size_goal); |
850 | 846 | ||
851 | /* We try hard to avoid divides here */ | 847 | /* We try hard to avoid divides here */ |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index c215be70cac0..ace8daca5c83 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -325,14 +325,34 @@ void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu) | |||
325 | kfree_skb(skb); | 325 | kfree_skb(skb); |
326 | } | 326 | } |
327 | 327 | ||
328 | static void ip6_datagram_prepare_pktinfo_errqueue(struct sk_buff *skb) | 328 | /* IPv6 supports cmsg on all origins aside from SO_EE_ORIGIN_LOCAL. |
329 | * | ||
330 | * At one point, excluding local errors was a quick test to identify icmp/icmp6 | ||
331 | * errors. This is no longer true, but the test remained, so the v6 stack, | ||
332 | * unlike v4, also honors cmsg requests on all wifi and timestamp errors. | ||
333 | * | ||
334 | * Timestamp code paths do not initialize the fields expected by cmsg: | ||
335 | * the PKTINFO fields in skb->cb[]. Fill those in here. | ||
336 | */ | ||
337 | static bool ip6_datagram_support_cmsg(struct sk_buff *skb, | ||
338 | struct sock_exterr_skb *serr) | ||
329 | { | 339 | { |
330 | int ifindex = skb->dev ? skb->dev->ifindex : -1; | 340 | if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP || |
341 | serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) | ||
342 | return true; | ||
343 | |||
344 | if (serr->ee.ee_origin == SO_EE_ORIGIN_LOCAL) | ||
345 | return false; | ||
346 | |||
347 | if (!skb->dev) | ||
348 | return false; | ||
331 | 349 | ||
332 | if (skb->protocol == htons(ETH_P_IPV6)) | 350 | if (skb->protocol == htons(ETH_P_IPV6)) |
333 | IP6CB(skb)->iif = ifindex; | 351 | IP6CB(skb)->iif = skb->dev->ifindex; |
334 | else | 352 | else |
335 | PKTINFO_SKB_CB(skb)->ipi_ifindex = ifindex; | 353 | PKTINFO_SKB_CB(skb)->ipi_ifindex = skb->dev->ifindex; |
354 | |||
355 | return true; | ||
336 | } | 356 | } |
337 | 357 | ||
338 | /* | 358 | /* |
@@ -369,7 +389,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) | |||
369 | 389 | ||
370 | serr = SKB_EXT_ERR(skb); | 390 | serr = SKB_EXT_ERR(skb); |
371 | 391 | ||
372 | if (sin && skb->len) { | 392 | if (sin && serr->port) { |
373 | const unsigned char *nh = skb_network_header(skb); | 393 | const unsigned char *nh = skb_network_header(skb); |
374 | sin->sin6_family = AF_INET6; | 394 | sin->sin6_family = AF_INET6; |
375 | sin->sin6_flowinfo = 0; | 395 | sin->sin6_flowinfo = 0; |
@@ -394,14 +414,11 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) | |||
394 | memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err)); | 414 | memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err)); |
395 | sin = &errhdr.offender; | 415 | sin = &errhdr.offender; |
396 | memset(sin, 0, sizeof(*sin)); | 416 | memset(sin, 0, sizeof(*sin)); |
397 | if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL && skb->len) { | 417 | |
418 | if (ip6_datagram_support_cmsg(skb, serr)) { | ||
398 | sin->sin6_family = AF_INET6; | 419 | sin->sin6_family = AF_INET6; |
399 | if (np->rxopt.all) { | 420 | if (np->rxopt.all) |
400 | if (serr->ee.ee_origin != SO_EE_ORIGIN_ICMP && | ||
401 | serr->ee.ee_origin != SO_EE_ORIGIN_ICMP6) | ||
402 | ip6_datagram_prepare_pktinfo_errqueue(skb); | ||
403 | ip6_datagram_recv_common_ctl(sk, msg, skb); | 421 | ip6_datagram_recv_common_ctl(sk, msg, skb); |
404 | } | ||
405 | if (skb->protocol == htons(ETH_P_IPV6)) { | 422 | if (skb->protocol == htons(ETH_P_IPV6)) { |
406 | sin->sin6_addr = ipv6_hdr(skb)->saddr; | 423 | sin->sin6_addr = ipv6_hdr(skb)->saddr; |
407 | if (np->rxopt.all) | 424 | if (np->rxopt.all) |
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index fee25c0ed1f5..263a5164a6f5 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c | |||
@@ -101,9 +101,10 @@ int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
101 | 101 | ||
102 | if (msg->msg_name) { | 102 | if (msg->msg_name) { |
103 | DECLARE_SOCKADDR(struct sockaddr_in6 *, u, msg->msg_name); | 103 | DECLARE_SOCKADDR(struct sockaddr_in6 *, u, msg->msg_name); |
104 | if (msg->msg_namelen < sizeof(struct sockaddr_in6) || | 104 | if (msg->msg_namelen < sizeof(*u)) |
105 | u->sin6_family != AF_INET6) { | ||
106 | return -EINVAL; | 105 | return -EINVAL; |
106 | if (u->sin6_family != AF_INET6) { | ||
107 | return -EAFNOSUPPORT; | ||
107 | } | 108 | } |
108 | if (sk->sk_bound_dev_if && | 109 | if (sk->sk_bound_dev_if && |
109 | sk->sk_bound_dev_if != u->sin6_scope_id) { | 110 | sk->sk_bound_dev_if != u->sin6_scope_id) { |
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 9940a41efca1..683346d2d633 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
@@ -798,7 +798,9 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) | |||
798 | orig_jiffies = jiffies; | 798 | orig_jiffies = jiffies; |
799 | 799 | ||
800 | /* Set poll time to 200 ms */ | 800 | /* Set poll time to 200 ms */ |
801 | poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200)); | 801 | poll_time = msecs_to_jiffies(200); |
802 | if (timeout) | ||
803 | poll_time = min_t(unsigned long, timeout, poll_time); | ||
802 | 804 | ||
803 | spin_lock_irqsave(&self->spinlock, flags); | 805 | spin_lock_irqsave(&self->spinlock, flags); |
804 | while (self->tx_skb && self->tx_skb->len) { | 806 | while (self->tx_skb && self->tx_skb->len) { |
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index f96229cdb6e1..08d95559b6f7 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c | |||
@@ -913,6 +913,8 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param, | |||
913 | IP_VS_DBG(2, "BACKUP, add new conn. failed\n"); | 913 | IP_VS_DBG(2, "BACKUP, add new conn. failed\n"); |
914 | return; | 914 | return; |
915 | } | 915 | } |
916 | if (!(flags & IP_VS_CONN_F_TEMPLATE)) | ||
917 | kfree(param->pe_data); | ||
916 | } | 918 | } |
917 | 919 | ||
918 | if (opt) | 920 | if (opt) |
@@ -1186,6 +1188,7 @@ static inline int ip_vs_proc_sync_conn(struct net *net, __u8 *p, __u8 *msg_end) | |||
1186 | (opt_flags & IPVS_OPT_F_SEQ_DATA ? &opt : NULL) | 1188 | (opt_flags & IPVS_OPT_F_SEQ_DATA ? &opt : NULL) |
1187 | ); | 1189 | ); |
1188 | #endif | 1190 | #endif |
1191 | ip_vs_pe_put(param.pe); | ||
1189 | return 0; | 1192 | return 0; |
1190 | /* Error exit */ | 1193 | /* Error exit */ |
1191 | out: | 1194 | out: |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 284b20ce566b..ea51833c8f5a 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -227,7 +227,7 @@ nft_rule_deactivate_next(struct net *net, struct nft_rule *rule) | |||
227 | 227 | ||
228 | static inline void nft_rule_clear(struct net *net, struct nft_rule *rule) | 228 | static inline void nft_rule_clear(struct net *net, struct nft_rule *rule) |
229 | { | 229 | { |
230 | rule->genmask = 0; | 230 | rule->genmask &= ~(1 << gencursor_next(net)); |
231 | } | 231 | } |
232 | 232 | ||
233 | static int | 233 | static int |
@@ -1712,9 +1712,12 @@ static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net, | |||
1712 | } | 1712 | } |
1713 | nla_nest_end(skb, list); | 1713 | nla_nest_end(skb, list); |
1714 | 1714 | ||
1715 | if (rule->ulen && | 1715 | if (rule->udata) { |
1716 | nla_put(skb, NFTA_RULE_USERDATA, rule->ulen, nft_userdata(rule))) | 1716 | struct nft_userdata *udata = nft_userdata(rule); |
1717 | goto nla_put_failure; | 1717 | if (nla_put(skb, NFTA_RULE_USERDATA, udata->len + 1, |
1718 | udata->data) < 0) | ||
1719 | goto nla_put_failure; | ||
1720 | } | ||
1718 | 1721 | ||
1719 | nlmsg_end(skb, nlh); | 1722 | nlmsg_end(skb, nlh); |
1720 | return 0; | 1723 | return 0; |
@@ -1897,11 +1900,12 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | |||
1897 | struct nft_table *table; | 1900 | struct nft_table *table; |
1898 | struct nft_chain *chain; | 1901 | struct nft_chain *chain; |
1899 | struct nft_rule *rule, *old_rule = NULL; | 1902 | struct nft_rule *rule, *old_rule = NULL; |
1903 | struct nft_userdata *udata; | ||
1900 | struct nft_trans *trans = NULL; | 1904 | struct nft_trans *trans = NULL; |
1901 | struct nft_expr *expr; | 1905 | struct nft_expr *expr; |
1902 | struct nft_ctx ctx; | 1906 | struct nft_ctx ctx; |
1903 | struct nlattr *tmp; | 1907 | struct nlattr *tmp; |
1904 | unsigned int size, i, n, ulen = 0; | 1908 | unsigned int size, i, n, ulen = 0, usize = 0; |
1905 | int err, rem; | 1909 | int err, rem; |
1906 | bool create; | 1910 | bool create; |
1907 | u64 handle, pos_handle; | 1911 | u64 handle, pos_handle; |
@@ -1969,12 +1973,19 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | |||
1969 | n++; | 1973 | n++; |
1970 | } | 1974 | } |
1971 | } | 1975 | } |
1976 | /* Check for overflow of dlen field */ | ||
1977 | err = -EFBIG; | ||
1978 | if (size >= 1 << 12) | ||
1979 | goto err1; | ||
1972 | 1980 | ||
1973 | if (nla[NFTA_RULE_USERDATA]) | 1981 | if (nla[NFTA_RULE_USERDATA]) { |
1974 | ulen = nla_len(nla[NFTA_RULE_USERDATA]); | 1982 | ulen = nla_len(nla[NFTA_RULE_USERDATA]); |
1983 | if (ulen > 0) | ||
1984 | usize = sizeof(struct nft_userdata) + ulen; | ||
1985 | } | ||
1975 | 1986 | ||
1976 | err = -ENOMEM; | 1987 | err = -ENOMEM; |
1977 | rule = kzalloc(sizeof(*rule) + size + ulen, GFP_KERNEL); | 1988 | rule = kzalloc(sizeof(*rule) + size + usize, GFP_KERNEL); |
1978 | if (rule == NULL) | 1989 | if (rule == NULL) |
1979 | goto err1; | 1990 | goto err1; |
1980 | 1991 | ||
@@ -1982,10 +1993,13 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | |||
1982 | 1993 | ||
1983 | rule->handle = handle; | 1994 | rule->handle = handle; |
1984 | rule->dlen = size; | 1995 | rule->dlen = size; |
1985 | rule->ulen = ulen; | 1996 | rule->udata = ulen ? 1 : 0; |
1986 | 1997 | ||
1987 | if (ulen) | 1998 | if (ulen) { |
1988 | nla_memcpy(nft_userdata(rule), nla[NFTA_RULE_USERDATA], ulen); | 1999 | udata = nft_userdata(rule); |
2000 | udata->len = ulen - 1; | ||
2001 | nla_memcpy(udata->data, nla[NFTA_RULE_USERDATA], ulen); | ||
2002 | } | ||
1989 | 2003 | ||
1990 | expr = nft_expr_first(rule); | 2004 | expr = nft_expr_first(rule); |
1991 | for (i = 0; i < n; i++) { | 2005 | for (i = 0; i < n; i++) { |
@@ -2032,12 +2046,6 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | |||
2032 | 2046 | ||
2033 | err3: | 2047 | err3: |
2034 | list_del_rcu(&rule->list); | 2048 | list_del_rcu(&rule->list); |
2035 | if (trans) { | ||
2036 | list_del_rcu(&nft_trans_rule(trans)->list); | ||
2037 | nft_rule_clear(net, nft_trans_rule(trans)); | ||
2038 | nft_trans_destroy(trans); | ||
2039 | chain->use++; | ||
2040 | } | ||
2041 | err2: | 2049 | err2: |
2042 | nf_tables_rule_destroy(&ctx, rule); | 2050 | nf_tables_rule_destroy(&ctx, rule); |
2043 | err1: | 2051 | err1: |
@@ -3613,12 +3621,11 @@ static int nf_tables_commit(struct sk_buff *skb) | |||
3613 | &te->elem, | 3621 | &te->elem, |
3614 | NFT_MSG_DELSETELEM, 0); | 3622 | NFT_MSG_DELSETELEM, 0); |
3615 | te->set->ops->get(te->set, &te->elem); | 3623 | te->set->ops->get(te->set, &te->elem); |
3616 | te->set->ops->remove(te->set, &te->elem); | ||
3617 | nft_data_uninit(&te->elem.key, NFT_DATA_VALUE); | 3624 | nft_data_uninit(&te->elem.key, NFT_DATA_VALUE); |
3618 | if (te->elem.flags & NFT_SET_MAP) { | 3625 | if (te->set->flags & NFT_SET_MAP && |
3619 | nft_data_uninit(&te->elem.data, | 3626 | !(te->elem.flags & NFT_SET_ELEM_INTERVAL_END)) |
3620 | te->set->dtype); | 3627 | nft_data_uninit(&te->elem.data, te->set->dtype); |
3621 | } | 3628 | te->set->ops->remove(te->set, &te->elem); |
3622 | nft_trans_destroy(trans); | 3629 | nft_trans_destroy(trans); |
3623 | break; | 3630 | break; |
3624 | } | 3631 | } |
@@ -3659,7 +3666,7 @@ static int nf_tables_abort(struct sk_buff *skb) | |||
3659 | { | 3666 | { |
3660 | struct net *net = sock_net(skb->sk); | 3667 | struct net *net = sock_net(skb->sk); |
3661 | struct nft_trans *trans, *next; | 3668 | struct nft_trans *trans, *next; |
3662 | struct nft_set *set; | 3669 | struct nft_trans_elem *te; |
3663 | 3670 | ||
3664 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { | 3671 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { |
3665 | switch (trans->msg_type) { | 3672 | switch (trans->msg_type) { |
@@ -3720,9 +3727,13 @@ static int nf_tables_abort(struct sk_buff *skb) | |||
3720 | break; | 3727 | break; |
3721 | case NFT_MSG_NEWSETELEM: | 3728 | case NFT_MSG_NEWSETELEM: |
3722 | nft_trans_elem_set(trans)->nelems--; | 3729 | nft_trans_elem_set(trans)->nelems--; |
3723 | set = nft_trans_elem_set(trans); | 3730 | te = (struct nft_trans_elem *)trans->data; |
3724 | set->ops->get(set, &nft_trans_elem(trans)); | 3731 | te->set->ops->get(te->set, &te->elem); |
3725 | set->ops->remove(set, &nft_trans_elem(trans)); | 3732 | nft_data_uninit(&te->elem.key, NFT_DATA_VALUE); |
3733 | if (te->set->flags & NFT_SET_MAP && | ||
3734 | !(te->elem.flags & NFT_SET_ELEM_INTERVAL_END)) | ||
3735 | nft_data_uninit(&te->elem.data, te->set->dtype); | ||
3736 | te->set->ops->remove(te->set, &te->elem); | ||
3726 | nft_trans_destroy(trans); | 3737 | nft_trans_destroy(trans); |
3727 | break; | 3738 | break; |
3728 | case NFT_MSG_DELSETELEM: | 3739 | case NFT_MSG_DELSETELEM: |
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 29fbcf25f88f..0b0fd4e36294 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
@@ -125,7 +125,7 @@ static void | |||
125 | nft_target_set_tgchk_param(struct xt_tgchk_param *par, | 125 | nft_target_set_tgchk_param(struct xt_tgchk_param *par, |
126 | const struct nft_ctx *ctx, | 126 | const struct nft_ctx *ctx, |
127 | struct xt_target *target, void *info, | 127 | struct xt_target *target, void *info, |
128 | union nft_entry *entry, u8 proto, bool inv) | 128 | union nft_entry *entry, u16 proto, bool inv) |
129 | { | 129 | { |
130 | par->net = ctx->net; | 130 | par->net = ctx->net; |
131 | par->table = ctx->table->name; | 131 | par->table = ctx->table->name; |
@@ -139,7 +139,7 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par, | |||
139 | entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; | 139 | entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; |
140 | break; | 140 | break; |
141 | case NFPROTO_BRIDGE: | 141 | case NFPROTO_BRIDGE: |
142 | entry->ebt.ethproto = proto; | 142 | entry->ebt.ethproto = (__force __be16)proto; |
143 | entry->ebt.invflags = inv ? EBT_IPROTO : 0; | 143 | entry->ebt.invflags = inv ? EBT_IPROTO : 0; |
144 | break; | 144 | break; |
145 | case NFPROTO_ARP: | 145 | case NFPROTO_ARP: |
@@ -175,7 +175,7 @@ static const struct nla_policy nft_rule_compat_policy[NFTA_RULE_COMPAT_MAX + 1] | |||
175 | [NFTA_RULE_COMPAT_FLAGS] = { .type = NLA_U32 }, | 175 | [NFTA_RULE_COMPAT_FLAGS] = { .type = NLA_U32 }, |
176 | }; | 176 | }; |
177 | 177 | ||
178 | static int nft_parse_compat(const struct nlattr *attr, u8 *proto, bool *inv) | 178 | static int nft_parse_compat(const struct nlattr *attr, u16 *proto, bool *inv) |
179 | { | 179 | { |
180 | struct nlattr *tb[NFTA_RULE_COMPAT_MAX+1]; | 180 | struct nlattr *tb[NFTA_RULE_COMPAT_MAX+1]; |
181 | u32 flags; | 181 | u32 flags; |
@@ -207,7 +207,7 @@ nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
207 | struct xt_target *target = expr->ops->data; | 207 | struct xt_target *target = expr->ops->data; |
208 | struct xt_tgchk_param par; | 208 | struct xt_tgchk_param par; |
209 | size_t size = XT_ALIGN(nla_len(tb[NFTA_TARGET_INFO])); | 209 | size_t size = XT_ALIGN(nla_len(tb[NFTA_TARGET_INFO])); |
210 | u8 proto = 0; | 210 | u16 proto = 0; |
211 | bool inv = false; | 211 | bool inv = false; |
212 | union nft_entry e = {}; | 212 | union nft_entry e = {}; |
213 | int ret; | 213 | int ret; |
@@ -338,7 +338,7 @@ static const struct nla_policy nft_match_policy[NFTA_MATCH_MAX + 1] = { | |||
338 | static void | 338 | static void |
339 | nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, | 339 | nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, |
340 | struct xt_match *match, void *info, | 340 | struct xt_match *match, void *info, |
341 | union nft_entry *entry, u8 proto, bool inv) | 341 | union nft_entry *entry, u16 proto, bool inv) |
342 | { | 342 | { |
343 | par->net = ctx->net; | 343 | par->net = ctx->net; |
344 | par->table = ctx->table->name; | 344 | par->table = ctx->table->name; |
@@ -352,7 +352,7 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, | |||
352 | entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; | 352 | entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; |
353 | break; | 353 | break; |
354 | case NFPROTO_BRIDGE: | 354 | case NFPROTO_BRIDGE: |
355 | entry->ebt.ethproto = proto; | 355 | entry->ebt.ethproto = (__force __be16)proto; |
356 | entry->ebt.invflags = inv ? EBT_IPROTO : 0; | 356 | entry->ebt.invflags = inv ? EBT_IPROTO : 0; |
357 | break; | 357 | break; |
358 | case NFPROTO_ARP: | 358 | case NFPROTO_ARP: |
@@ -391,7 +391,7 @@ nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
391 | struct xt_match *match = expr->ops->data; | 391 | struct xt_match *match = expr->ops->data; |
392 | struct xt_mtchk_param par; | 392 | struct xt_mtchk_param par; |
393 | size_t size = XT_ALIGN(nla_len(tb[NFTA_MATCH_INFO])); | 393 | size_t size = XT_ALIGN(nla_len(tb[NFTA_MATCH_INFO])); |
394 | u8 proto = 0; | 394 | u16 proto = 0; |
395 | bool inv = false; | 395 | bool inv = false; |
396 | union nft_entry e = {}; | 396 | union nft_entry e = {}; |
397 | int ret; | 397 | int ret; |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 8167aecc1594..b91ac5946ad1 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -3139,11 +3139,18 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i, | |||
3139 | return 0; | 3139 | return 0; |
3140 | } | 3140 | } |
3141 | 3141 | ||
3142 | static void packet_dev_mclist(struct net_device *dev, struct packet_mclist *i, int what) | 3142 | static void packet_dev_mclist_delete(struct net_device *dev, |
3143 | struct packet_mclist **mlp) | ||
3143 | { | 3144 | { |
3144 | for ( ; i; i = i->next) { | 3145 | struct packet_mclist *ml; |
3145 | if (i->ifindex == dev->ifindex) | 3146 | |
3146 | packet_dev_mc(dev, i, what); | 3147 | while ((ml = *mlp) != NULL) { |
3148 | if (ml->ifindex == dev->ifindex) { | ||
3149 | packet_dev_mc(dev, ml, -1); | ||
3150 | *mlp = ml->next; | ||
3151 | kfree(ml); | ||
3152 | } else | ||
3153 | mlp = &ml->next; | ||
3147 | } | 3154 | } |
3148 | } | 3155 | } |
3149 | 3156 | ||
@@ -3220,12 +3227,11 @@ static int packet_mc_drop(struct sock *sk, struct packet_mreq_max *mreq) | |||
3220 | packet_dev_mc(dev, ml, -1); | 3227 | packet_dev_mc(dev, ml, -1); |
3221 | kfree(ml); | 3228 | kfree(ml); |
3222 | } | 3229 | } |
3223 | rtnl_unlock(); | 3230 | break; |
3224 | return 0; | ||
3225 | } | 3231 | } |
3226 | } | 3232 | } |
3227 | rtnl_unlock(); | 3233 | rtnl_unlock(); |
3228 | return -EADDRNOTAVAIL; | 3234 | return 0; |
3229 | } | 3235 | } |
3230 | 3236 | ||
3231 | static void packet_flush_mclist(struct sock *sk) | 3237 | static void packet_flush_mclist(struct sock *sk) |
@@ -3575,7 +3581,7 @@ static int packet_notifier(struct notifier_block *this, | |||
3575 | switch (msg) { | 3581 | switch (msg) { |
3576 | case NETDEV_UNREGISTER: | 3582 | case NETDEV_UNREGISTER: |
3577 | if (po->mclist) | 3583 | if (po->mclist) |
3578 | packet_dev_mclist(dev, po->mclist, -1); | 3584 | packet_dev_mclist_delete(dev, &po->mclist); |
3579 | /* fallthrough */ | 3585 | /* fallthrough */ |
3580 | 3586 | ||
3581 | case NETDEV_DOWN: | 3587 | case NETDEV_DOWN: |
diff --git a/net/rxrpc/ar-error.c b/net/rxrpc/ar-error.c index 5394b6be46ec..0610efa83d72 100644 --- a/net/rxrpc/ar-error.c +++ b/net/rxrpc/ar-error.c | |||
@@ -42,7 +42,8 @@ void rxrpc_UDP_error_report(struct sock *sk) | |||
42 | _leave("UDP socket errqueue empty"); | 42 | _leave("UDP socket errqueue empty"); |
43 | return; | 43 | return; |
44 | } | 44 | } |
45 | if (!skb->len) { | 45 | serr = SKB_EXT_ERR(skb); |
46 | if (!skb->len && serr->ee.ee_origin == SO_EE_ORIGIN_TIMESTAMPING) { | ||
46 | _leave("UDP empty message"); | 47 | _leave("UDP empty message"); |
47 | kfree_skb(skb); | 48 | kfree_skb(skb); |
48 | return; | 49 | return; |
@@ -50,7 +51,6 @@ void rxrpc_UDP_error_report(struct sock *sk) | |||
50 | 51 | ||
51 | rxrpc_new_skb(skb); | 52 | rxrpc_new_skb(skb); |
52 | 53 | ||
53 | serr = SKB_EXT_ERR(skb); | ||
54 | addr = *(__be32 *)(skb_network_header(skb) + serr->addr_offset); | 54 | addr = *(__be32 *)(skb_network_header(skb) + serr->addr_offset); |
55 | port = serr->port; | 55 | port = serr->port; |
56 | 56 | ||
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 33fb105d4352..5199bb1a017e 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -921,7 +921,7 @@ static unsigned int cache_poll(struct file *filp, poll_table *wait, | |||
921 | poll_wait(filp, &queue_wait, wait); | 921 | poll_wait(filp, &queue_wait, wait); |
922 | 922 | ||
923 | /* alway allow write */ | 923 | /* alway allow write */ |
924 | mask = POLL_OUT | POLLWRNORM; | 924 | mask = POLLOUT | POLLWRNORM; |
925 | 925 | ||
926 | if (!rp) | 926 | if (!rp) |
927 | return mask; | 927 | return mask; |
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 7e9acd9361c5..91ffde82fa0c 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c | |||
@@ -738,8 +738,9 @@ rpcrdma_reply_handler(struct rpcrdma_rep *rep) | |||
738 | struct rpc_xprt *xprt = rep->rr_xprt; | 738 | struct rpc_xprt *xprt = rep->rr_xprt; |
739 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); | 739 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); |
740 | __be32 *iptr; | 740 | __be32 *iptr; |
741 | int credits, rdmalen, status; | 741 | int rdmalen, status; |
742 | unsigned long cwnd; | 742 | unsigned long cwnd; |
743 | u32 credits; | ||
743 | 744 | ||
744 | /* Check status. If bad, signal disconnect and return rep to pool */ | 745 | /* Check status. If bad, signal disconnect and return rep to pool */ |
745 | if (rep->rr_len == ~0U) { | 746 | if (rep->rr_len == ~0U) { |
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index d1b70397c60f..0a16fb6f0885 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h | |||
@@ -285,7 +285,7 @@ rpcr_to_rdmar(struct rpc_rqst *rqst) | |||
285 | */ | 285 | */ |
286 | struct rpcrdma_buffer { | 286 | struct rpcrdma_buffer { |
287 | spinlock_t rb_lock; /* protects indexes */ | 287 | spinlock_t rb_lock; /* protects indexes */ |
288 | int rb_max_requests;/* client max requests */ | 288 | u32 rb_max_requests;/* client max requests */ |
289 | struct list_head rb_mws; /* optional memory windows/fmrs/frmrs */ | 289 | struct list_head rb_mws; /* optional memory windows/fmrs/frmrs */ |
290 | struct list_head rb_all; | 290 | struct list_head rb_all; |
291 | int rb_send_index; | 291 | int rb_send_index; |
diff --git a/net/tipc/link.c b/net/tipc/link.c index a4cf364316de..14f09b3cb87c 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -464,10 +464,11 @@ void tipc_link_reset(struct tipc_link *l_ptr) | |||
464 | /* Clean up all queues, except inputq: */ | 464 | /* Clean up all queues, except inputq: */ |
465 | __skb_queue_purge(&l_ptr->outqueue); | 465 | __skb_queue_purge(&l_ptr->outqueue); |
466 | __skb_queue_purge(&l_ptr->deferred_queue); | 466 | __skb_queue_purge(&l_ptr->deferred_queue); |
467 | skb_queue_splice_init(&l_ptr->wakeupq, &l_ptr->inputq); | 467 | if (!owner->inputq) |
468 | if (!skb_queue_empty(&l_ptr->inputq)) | 468 | owner->inputq = &l_ptr->inputq; |
469 | skb_queue_splice_init(&l_ptr->wakeupq, owner->inputq); | ||
470 | if (!skb_queue_empty(owner->inputq)) | ||
469 | owner->action_flags |= TIPC_MSG_EVT; | 471 | owner->action_flags |= TIPC_MSG_EVT; |
470 | owner->inputq = &l_ptr->inputq; | ||
471 | l_ptr->next_out = NULL; | 472 | l_ptr->next_out = NULL; |
472 | l_ptr->unacked_window = 0; | 473 | l_ptr->unacked_window = 0; |
473 | l_ptr->checkpoint = 1; | 474 | l_ptr->checkpoint = 1; |