aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-17 16:52:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-17 16:52:59 -0500
commit7f151f1d8abb7d5930b49d4796b463dca1673cb7 (patch)
treef995b6444729c105fe0a123b8240ef3dc3f1bf4a /include
parenta18ab2f6cb79eeccedea61b8c7bf71d24e087d42 (diff)
parente7523a497d48a9921983a80670f7a02dc4639d41 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix list tests in netfilter ingress support, from Florian Westphal. 2) Fix reversal of input and output interfaces in ingress hook invocation, from Pablo Neira Ayuso. 3) We have a use after free in r8169, caught by Dave Jones, fixed by Francois Romieu. 4) Splice use-after-free fix in AF_UNIX frmo Hannes Frederic Sowa. 5) Three ipv6 route handling bug fixes from Martin KaFai Lau: a) Don't create clone routes not managed by the fib6 tree b) Don't forget to check expiration of DST_NOCACHE routes. c) Handle rt->dst.from == NULL properly. 6) Several AF_PACKET fixes wrt transport header setting and SKB protocol setting, from Daniel Borkmann. 7) Fix thunder driver crash on shutdown, from Pavel Fedin. 8) Several Mellanox driver fixes (max MTU calculations, use of correct DMA unmap in TX path, etc.) from Saeed Mahameed, Tariq Toukan, Doron Tsur, Achiad Shochat, Eran Ben Elisha, and Noa Osherovich. 9) Several mv88e6060 DSA driver fixes (wrong bit definitions for certain registers, etc.) from Neil Armstrong. 10) Make sure to disable preemption while updating per-cpu stats of ip tunnels, from Jason A. Donenfeld. 11) Various ARM64 bpf JIT fixes, from Yang Shi. 12) Flush icache properly in ARM JITs, from Daniel Borkmann. 13) Fix masking of RX and TX interrupts in ravb driver, from Masaru Nagai. 14) Fix netdev feature propagation for devices not implementing ->ndo_set_features(). From Nikolay Aleksandrov. 15) Big endian fix in vmxnet3 driver, from Shrikrishna Khare. 16) RAW socket code increments incorrect SNMP counters, fix from Ben Cartwright-Cox. 17) IPv6 multicast SNMP counters are bumped twice, fix from Neil Horman. 18) Fix handling of VLAN headers on stacked devices when REORDER is disabled. From Vlad Yasevich. 19) Fix SKB leaks and use-after-free in ipvlan and macvlan drivers, from Sabrina Dubroca. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (83 commits) MAINTAINERS: Update Mellanox's Eth NIC driver entries net/core: revert "net: fix __netdev_update_features return.." and add comment af_unix: take receive queue lock while appending new skb rtnetlink: fix frame size warning in rtnl_fill_ifinfo net: use skb_clone to avoid alloc_pages failure. packet: Use PAGE_ALIGNED macro packet: Don't check frames_per_block against negative values net: phy: Use interrupts when available in NOLINK state phy: marvell: Add support for 88E1540 PHY arm64: bpf: make BPF prologue and epilogue align with ARM64 AAPCS macvlan: fix leak in macvlan_handle_frame ipvlan: fix use after free of skb ipvlan: fix leak in ipvlan_rcv_frame vlan: Do not put vlan headers back on bridge and macvlan ports vlan: Fix untag operations of stacked vlans with REORDER_HEADER off via-velocity: unconditionally drop frames with bad l2 length ipg: Remove ipg driver dl2k: Add support for IP1000A-based cards snmp: Remove duplicate OUTMCAST stat increment net: thunder: Check for driver data in nicvf_remove() ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/marvell_phy.h1
-rw-r--r--include/linux/mlx5/mlx5_ifc.h24
-rw-r--r--include/linux/netdevice.h32
-rw-r--r--include/linux/netfilter/ipset/ip_set.h2
-rw-r--r--include/linux/netfilter_ingress.h13
-rw-r--r--include/net/ip6_fib.h3
-rw-r--r--include/net/ip6_tunnel.h3
-rw-r--r--include/net/ip_tunnels.h3
-rw-r--r--include/net/netfilter/nf_tables.h16
-rw-r--r--include/net/sock.h25
-rw-r--r--include/net/switchdev.h2
11 files changed, 90 insertions, 34 deletions
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index e6982ac3200d..a57f0dfb6db7 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -16,6 +16,7 @@
16#define MARVELL_PHY_ID_88E1318S 0x01410e90 16#define MARVELL_PHY_ID_88E1318S 0x01410e90
17#define MARVELL_PHY_ID_88E1116R 0x01410e40 17#define MARVELL_PHY_ID_88E1116R 0x01410e40
18#define MARVELL_PHY_ID_88E1510 0x01410dd0 18#define MARVELL_PHY_ID_88E1510 0x01410dd0
19#define MARVELL_PHY_ID_88E1540 0x01410eb0
19#define MARVELL_PHY_ID_88E3016 0x01410e60 20#define MARVELL_PHY_ID_88E3016 0x01410e60
20 21
21/* struct phy_device dev_flags definitions */ 22/* struct phy_device dev_flags definitions */
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index dd2097455a2e..1565324eb620 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -453,26 +453,28 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {
453 u8 lro_cap[0x1]; 453 u8 lro_cap[0x1];
454 u8 lro_psh_flag[0x1]; 454 u8 lro_psh_flag[0x1];
455 u8 lro_time_stamp[0x1]; 455 u8 lro_time_stamp[0x1];
456 u8 reserved_0[0x6]; 456 u8 reserved_0[0x3];
457 u8 self_lb_en_modifiable[0x1];
458 u8 reserved_1[0x2];
457 u8 max_lso_cap[0x5]; 459 u8 max_lso_cap[0x5];
458 u8 reserved_1[0x4]; 460 u8 reserved_2[0x4];
459 u8 rss_ind_tbl_cap[0x4]; 461 u8 rss_ind_tbl_cap[0x4];
460 u8 reserved_2[0x3]; 462 u8 reserved_3[0x3];
461 u8 tunnel_lso_const_out_ip_id[0x1]; 463 u8 tunnel_lso_const_out_ip_id[0x1];
462 u8 reserved_3[0x2]; 464 u8 reserved_4[0x2];
463 u8 tunnel_statless_gre[0x1]; 465 u8 tunnel_statless_gre[0x1];
464 u8 tunnel_stateless_vxlan[0x1]; 466 u8 tunnel_stateless_vxlan[0x1];
465 467
466 u8 reserved_4[0x20]; 468 u8 reserved_5[0x20];
467 469
468 u8 reserved_5[0x10]; 470 u8 reserved_6[0x10];
469 u8 lro_min_mss_size[0x10]; 471 u8 lro_min_mss_size[0x10];
470 472
471 u8 reserved_6[0x120]; 473 u8 reserved_7[0x120];
472 474
473 u8 lro_timer_supported_periods[4][0x20]; 475 u8 lro_timer_supported_periods[4][0x20];
474 476
475 u8 reserved_7[0x600]; 477 u8 reserved_8[0x600];
476}; 478};
477 479
478struct mlx5_ifc_roce_cap_bits { 480struct mlx5_ifc_roce_cap_bits {
@@ -4051,9 +4053,11 @@ struct mlx5_ifc_modify_tis_in_bits {
4051}; 4053};
4052 4054
4053struct mlx5_ifc_modify_tir_bitmask_bits { 4055struct mlx5_ifc_modify_tir_bitmask_bits {
4054 u8 reserved[0x20]; 4056 u8 reserved_0[0x20];
4055 4057
4056 u8 reserved1[0x1f]; 4058 u8 reserved_1[0x1b];
4059 u8 self_lb_en[0x1];
4060 u8 reserved_2[0x3];
4057 u8 lro[0x1]; 4061 u8 lro[0x1];
4058}; 4062};
4059 4063
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d20891465247..67bfac1abfc1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2068,20 +2068,23 @@ struct pcpu_sw_netstats {
2068 struct u64_stats_sync syncp; 2068 struct u64_stats_sync syncp;
2069}; 2069};
2070 2070
2071#define netdev_alloc_pcpu_stats(type) \ 2071#define __netdev_alloc_pcpu_stats(type, gfp) \
2072({ \ 2072({ \
2073 typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \ 2073 typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\
2074 if (pcpu_stats) { \ 2074 if (pcpu_stats) { \
2075 int __cpu; \ 2075 int __cpu; \
2076 for_each_possible_cpu(__cpu) { \ 2076 for_each_possible_cpu(__cpu) { \
2077 typeof(type) *stat; \ 2077 typeof(type) *stat; \
2078 stat = per_cpu_ptr(pcpu_stats, __cpu); \ 2078 stat = per_cpu_ptr(pcpu_stats, __cpu); \
2079 u64_stats_init(&stat->syncp); \ 2079 u64_stats_init(&stat->syncp); \
2080 } \ 2080 } \
2081 } \ 2081 } \
2082 pcpu_stats; \ 2082 pcpu_stats; \
2083}) 2083})
2084 2084
2085#define netdev_alloc_pcpu_stats(type) \
2086 __netdev_alloc_pcpu_stats(type, GFP_KERNEL);
2087
2085#include <linux/notifier.h> 2088#include <linux/notifier.h>
2086 2089
2087/* netdevice notifier chain. Please remember to update the rtnetlink 2090/* netdevice notifier chain. Please remember to update the rtnetlink
@@ -3854,6 +3857,11 @@ static inline bool netif_is_bridge_master(const struct net_device *dev)
3854 return dev->priv_flags & IFF_EBRIDGE; 3857 return dev->priv_flags & IFF_EBRIDGE;
3855} 3858}
3856 3859
3860static inline bool netif_is_bridge_port(const struct net_device *dev)
3861{
3862 return dev->priv_flags & IFF_BRIDGE_PORT;
3863}
3864
3857static inline bool netif_is_ovs_master(const struct net_device *dev) 3865static inline bool netif_is_ovs_master(const struct net_device *dev)
3858{ 3866{
3859 return dev->priv_flags & IFF_OPENVSWITCH; 3867 return dev->priv_flags & IFF_OPENVSWITCH;
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 48bb01edcf30..0e1f433cc4b7 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -421,7 +421,7 @@ extern void ip_set_free(void *members);
421extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); 421extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr);
422extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); 422extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr);
423extern size_t ip_set_elem_len(struct ip_set *set, struct nlattr *tb[], 423extern size_t ip_set_elem_len(struct ip_set *set, struct nlattr *tb[],
424 size_t len); 424 size_t len, size_t align);
425extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[], 425extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[],
426 struct ip_set_ext *ext); 426 struct ip_set_ext *ext);
427 427
diff --git a/include/linux/netfilter_ingress.h b/include/linux/netfilter_ingress.h
index 187feabe557c..5fcd375ef175 100644
--- a/include/linux/netfilter_ingress.h
+++ b/include/linux/netfilter_ingress.h
@@ -5,10 +5,13 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6 6
7#ifdef CONFIG_NETFILTER_INGRESS 7#ifdef CONFIG_NETFILTER_INGRESS
8static inline int nf_hook_ingress_active(struct sk_buff *skb) 8static inline bool nf_hook_ingress_active(const struct sk_buff *skb)
9{ 9{
10 return nf_hook_list_active(&skb->dev->nf_hooks_ingress, 10#ifdef HAVE_JUMP_LABEL
11 NFPROTO_NETDEV, NF_NETDEV_INGRESS); 11 if (!static_key_false(&nf_hooks_needed[NFPROTO_NETDEV][NF_NETDEV_INGRESS]))
12 return false;
13#endif
14 return !list_empty(&skb->dev->nf_hooks_ingress);
12} 15}
13 16
14static inline int nf_hook_ingress(struct sk_buff *skb) 17static inline int nf_hook_ingress(struct sk_buff *skb)
@@ -16,8 +19,8 @@ static inline int nf_hook_ingress(struct sk_buff *skb)
16 struct nf_hook_state state; 19 struct nf_hook_state state;
17 20
18 nf_hook_state_init(&state, &skb->dev->nf_hooks_ingress, 21 nf_hook_state_init(&state, &skb->dev->nf_hooks_ingress,
19 NF_NETDEV_INGRESS, INT_MIN, NFPROTO_NETDEV, NULL, 22 NF_NETDEV_INGRESS, INT_MIN, NFPROTO_NETDEV,
20 skb->dev, NULL, dev_net(skb->dev), NULL); 23 skb->dev, NULL, NULL, dev_net(skb->dev), NULL);
21 return nf_hook_slow(skb, &state); 24 return nf_hook_slow(skb, &state);
22} 25}
23 26
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index aaf9700fc9e5..fb961a576abe 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -167,7 +167,8 @@ static inline void rt6_update_expires(struct rt6_info *rt0, int timeout)
167 167
168static inline u32 rt6_get_cookie(const struct rt6_info *rt) 168static inline u32 rt6_get_cookie(const struct rt6_info *rt)
169{ 169{
170 if (rt->rt6i_flags & RTF_PCPU || unlikely(rt->dst.flags & DST_NOCACHE)) 170 if (rt->rt6i_flags & RTF_PCPU ||
171 (unlikely(rt->dst.flags & DST_NOCACHE) && rt->dst.from))
171 rt = (struct rt6_info *)(rt->dst.from); 172 rt = (struct rt6_info *)(rt->dst.from);
172 173
173 return rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; 174 return rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index aaee6fa02cf1..ff788b665277 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -90,11 +90,12 @@ static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
90 err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb); 90 err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb);
91 91
92 if (net_xmit_eval(err) == 0) { 92 if (net_xmit_eval(err) == 0) {
93 struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); 93 struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
94 u64_stats_update_begin(&tstats->syncp); 94 u64_stats_update_begin(&tstats->syncp);
95 tstats->tx_bytes += pkt_len; 95 tstats->tx_bytes += pkt_len;
96 tstats->tx_packets++; 96 tstats->tx_packets++;
97 u64_stats_update_end(&tstats->syncp); 97 u64_stats_update_end(&tstats->syncp);
98 put_cpu_ptr(tstats);
98 } else { 99 } else {
99 stats->tx_errors++; 100 stats->tx_errors++;
100 stats->tx_aborted_errors++; 101 stats->tx_aborted_errors++;
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index f6dafec9102c..62a750a6a8f8 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -287,12 +287,13 @@ static inline void iptunnel_xmit_stats(int err,
287 struct pcpu_sw_netstats __percpu *stats) 287 struct pcpu_sw_netstats __percpu *stats)
288{ 288{
289 if (err > 0) { 289 if (err > 0) {
290 struct pcpu_sw_netstats *tstats = this_cpu_ptr(stats); 290 struct pcpu_sw_netstats *tstats = get_cpu_ptr(stats);
291 291
292 u64_stats_update_begin(&tstats->syncp); 292 u64_stats_update_begin(&tstats->syncp);
293 tstats->tx_bytes += err; 293 tstats->tx_bytes += err;
294 tstats->tx_packets++; 294 tstats->tx_packets++;
295 u64_stats_update_end(&tstats->syncp); 295 u64_stats_update_end(&tstats->syncp);
296 put_cpu_ptr(tstats);
296 } else if (err < 0) { 297 } else if (err < 0) {
297 err_stats->tx_errors++; 298 err_stats->tx_errors++;
298 err_stats->tx_aborted_errors++; 299 err_stats->tx_aborted_errors++;
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index c9149cc0a02d..4bd7508bedc9 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -618,6 +618,8 @@ struct nft_expr_ops {
618 void (*eval)(const struct nft_expr *expr, 618 void (*eval)(const struct nft_expr *expr,
619 struct nft_regs *regs, 619 struct nft_regs *regs,
620 const struct nft_pktinfo *pkt); 620 const struct nft_pktinfo *pkt);
621 int (*clone)(struct nft_expr *dst,
622 const struct nft_expr *src);
621 unsigned int size; 623 unsigned int size;
622 624
623 int (*init)(const struct nft_ctx *ctx, 625 int (*init)(const struct nft_ctx *ctx,
@@ -660,10 +662,20 @@ void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr);
660int nft_expr_dump(struct sk_buff *skb, unsigned int attr, 662int nft_expr_dump(struct sk_buff *skb, unsigned int attr,
661 const struct nft_expr *expr); 663 const struct nft_expr *expr);
662 664
663static inline void nft_expr_clone(struct nft_expr *dst, struct nft_expr *src) 665static inline int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src)
664{ 666{
667 int err;
668
665 __module_get(src->ops->type->owner); 669 __module_get(src->ops->type->owner);
666 memcpy(dst, src, src->ops->size); 670 if (src->ops->clone) {
671 dst->ops = src->ops;
672 err = src->ops->clone(dst, src);
673 if (err < 0)
674 return err;
675 } else {
676 memcpy(dst, src, src->ops->size);
677 }
678 return 0;
667} 679}
668 680
669/** 681/**
diff --git a/include/net/sock.h b/include/net/sock.h
index bbf7c2cf15b4..7f89e4ba18d1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2226,6 +2226,31 @@ static inline bool sk_listener(const struct sock *sk)
2226 return (1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV); 2226 return (1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV);
2227} 2227}
2228 2228
2229/**
2230 * sk_state_load - read sk->sk_state for lockless contexts
2231 * @sk: socket pointer
2232 *
2233 * Paired with sk_state_store(). Used in places we do not hold socket lock :
2234 * tcp_diag_get_info(), tcp_get_info(), tcp_poll(), get_tcp4_sock() ...
2235 */
2236static inline int sk_state_load(const struct sock *sk)
2237{
2238 return smp_load_acquire(&sk->sk_state);
2239}
2240
2241/**
2242 * sk_state_store - update sk->sk_state
2243 * @sk: socket pointer
2244 * @newstate: new state
2245 *
2246 * Paired with sk_state_load(). Should be used in contexts where
2247 * state change might impact lockless readers.
2248 */
2249static inline void sk_state_store(struct sock *sk, int newstate)
2250{
2251 smp_store_release(&sk->sk_state, newstate);
2252}
2253
2229void sock_enable_timestamp(struct sock *sk, int flag); 2254void sock_enable_timestamp(struct sock *sk, int flag);
2230int sock_get_timestamp(struct sock *, struct timeval __user *); 2255int sock_get_timestamp(struct sock *, struct timeval __user *);
2231int sock_get_timestampns(struct sock *, struct timespec __user *); 2256int sock_get_timestampns(struct sock *, struct timespec __user *);
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index bc865e244efe..1d22ce9f352e 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -323,7 +323,7 @@ static inline int switchdev_port_fdb_dump(struct sk_buff *skb,
323 struct net_device *filter_dev, 323 struct net_device *filter_dev,
324 int idx) 324 int idx)
325{ 325{
326 return -EOPNOTSUPP; 326 return idx;
327} 327}
328 328
329static inline void switchdev_port_fwd_mark_set(struct net_device *dev, 329static inline void switchdev_port_fwd_mark_set(struct net_device *dev,