Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix crash on bpf_prog_load() errors, from Daniel Borkmann. 2) Fix ATM VCC memory accounting, from David Woodhouse. 3) fib6_info objects need RCU freeing, from Eric Dumazet. 4) Fix SO_BINDTODEVICE handling for TCP sockets, from David Ahern. 5) Fix clobbered error code in enic_open() failure path, from Govindarajulu Varadarajan. 6) Propagate dev_get_valid_name() error returns properly, from Li RongQing. 7) Fix suspend/resume in davinci_emac driver, from Bartosz Golaszewski. 8) Various act_ife fixes (recursive locking, IDR leaks, etc.) from Davide Caratti. 9) Fix buggy checksum handling in sungem driver, from Eric Dumazet. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (40 commits) ip: limit use of gso_size to udp stmmac: fix DMA channel hang in half-duplex mode net: stmmac: socfpga: add additional ocp reset line for Stratix10 net: sungem: fix rx checksum support bpfilter: ignore binary files bpfilter: fix build error net/usb/drivers: Remove useless hrtimer_active check net/sched: act_ife: preserve the action control in case of error net/sched: act_ife: fix recursive lock and idr leak net: ethernet: fix suspend/resume in davinci_emac net: propagate dev_get_valid_name return code enic: do not overwrite error code net/tcp: Fix socket lookups with SO_BINDTODEVICE ptp: replace getnstimeofday64() with ktime_get_real_ts64() net/ipv6: respect rcu grace period before freeing fib6_info net: net_failover: fix typo in net_failover_slave_register() ipvlan: use ETH_MAX_MTU as max mtu net: hamradio: use eth_broadcast_addr enic: initialize enic->rfs_h.lock in enic_probe MAINTAINERS: Add Sam as the maintainer for NCSI ...
This commit is contained in:
@@ -214,6 +214,7 @@ struct atmphy_ops {
|
||||
struct atm_skb_data {
|
||||
struct atm_vcc *vcc; /* ATM VCC */
|
||||
unsigned long atm_options; /* ATM layer options */
|
||||
unsigned int acct_truesize; /* truesize accounted to vcc */
|
||||
};
|
||||
|
||||
#define VCC_HTABLE_SIZE 32
|
||||
@@ -241,6 +242,20 @@ void vcc_insert_socket(struct sock *sk);
|
||||
|
||||
void atm_dev_release_vccs(struct atm_dev *dev);
|
||||
|
||||
static inline void atm_account_tx(struct atm_vcc *vcc, struct sk_buff *skb)
|
||||
{
|
||||
/*
|
||||
* Because ATM skbs may not belong to a sock (and we don't
|
||||
* necessarily want to), skb->truesize may be adjusted,
|
||||
* escaping the hack in pskb_expand_head() which avoids
|
||||
* doing so for some cases. So stash the value of truesize
|
||||
* at the time we accounted it, and atm_pop_raw() can use
|
||||
* that value later, in case it changes.
|
||||
*/
|
||||
refcount_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
|
||||
ATM_SKB(skb)->acct_truesize = skb->truesize;
|
||||
ATM_SKB(skb)->atm_options = vcc->atm_options;
|
||||
}
|
||||
|
||||
static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
|
||||
{
|
||||
|
@@ -488,12 +488,15 @@ void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth);
|
||||
|
||||
/* Map specifics */
|
||||
struct xdp_buff;
|
||||
struct sk_buff;
|
||||
|
||||
struct bpf_dtab_netdev *__dev_map_lookup_elem(struct bpf_map *map, u32 key);
|
||||
void __dev_map_insert_ctx(struct bpf_map *map, u32 index);
|
||||
void __dev_map_flush(struct bpf_map *map);
|
||||
int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp,
|
||||
struct net_device *dev_rx);
|
||||
int dev_map_generic_redirect(struct bpf_dtab_netdev *dst, struct sk_buff *skb,
|
||||
struct bpf_prog *xdp_prog);
|
||||
|
||||
struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key);
|
||||
void __cpu_map_insert_ctx(struct bpf_map *map, u32 index);
|
||||
@@ -586,6 +589,15 @@ int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct sk_buff;
|
||||
|
||||
static inline int dev_map_generic_redirect(struct bpf_dtab_netdev *dst,
|
||||
struct sk_buff *skb,
|
||||
struct bpf_prog *xdp_prog)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline
|
||||
struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key)
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <linux/cryptohash.h>
|
||||
#include <linux/set_memory.h>
|
||||
#include <linux/kallsyms.h>
|
||||
#include <linux/if_vlan.h>
|
||||
|
||||
#include <net/sch_generic.h>
|
||||
|
||||
@@ -469,7 +470,8 @@ struct sock_fprog_kern {
|
||||
};
|
||||
|
||||
struct bpf_binary_header {
|
||||
unsigned int pages;
|
||||
u16 pages;
|
||||
u16 locked:1;
|
||||
u8 image[];
|
||||
};
|
||||
|
||||
@@ -671,15 +673,18 @@ bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default)
|
||||
|
||||
#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
|
||||
|
||||
#ifdef CONFIG_ARCH_HAS_SET_MEMORY
|
||||
static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_HAS_SET_MEMORY
|
||||
fp->locked = 1;
|
||||
WARN_ON_ONCE(set_memory_ro((unsigned long)fp, fp->pages));
|
||||
if (set_memory_ro((unsigned long)fp, fp->pages))
|
||||
fp->locked = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_HAS_SET_MEMORY
|
||||
if (fp->locked) {
|
||||
WARN_ON_ONCE(set_memory_rw((unsigned long)fp, fp->pages));
|
||||
/* In case set_memory_rw() fails, we want to be the first
|
||||
@@ -687,34 +692,30 @@ static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
|
||||
*/
|
||||
fp->locked = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr)
|
||||
{
|
||||
WARN_ON_ONCE(set_memory_ro((unsigned long)hdr, hdr->pages));
|
||||
#ifdef CONFIG_ARCH_HAS_SET_MEMORY
|
||||
hdr->locked = 1;
|
||||
if (set_memory_ro((unsigned long)hdr, hdr->pages))
|
||||
hdr->locked = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void bpf_jit_binary_unlock_ro(struct bpf_binary_header *hdr)
|
||||
{
|
||||
WARN_ON_ONCE(set_memory_rw((unsigned long)hdr, hdr->pages));
|
||||
#ifdef CONFIG_ARCH_HAS_SET_MEMORY
|
||||
if (hdr->locked) {
|
||||
WARN_ON_ONCE(set_memory_rw((unsigned long)hdr, hdr->pages));
|
||||
/* In case set_memory_rw() fails, we want to be the first
|
||||
* to crash here instead of some random place later on.
|
||||
*/
|
||||
hdr->locked = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void bpf_jit_binary_unlock_ro(struct bpf_binary_header *hdr)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_ARCH_HAS_SET_MEMORY */
|
||||
|
||||
static inline struct bpf_binary_header *
|
||||
bpf_jit_binary_hdr(const struct bpf_prog *fp)
|
||||
@@ -725,6 +726,22 @@ bpf_jit_binary_hdr(const struct bpf_prog *fp)
|
||||
return (void *)addr;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARCH_HAS_SET_MEMORY
|
||||
static inline int bpf_prog_check_pages_ro_single(const struct bpf_prog *fp)
|
||||
{
|
||||
if (!fp->locked)
|
||||
return -ENOLCK;
|
||||
if (fp->jited) {
|
||||
const struct bpf_binary_header *hdr = bpf_jit_binary_hdr(fp);
|
||||
|
||||
if (!hdr->locked)
|
||||
return -ENOLCK;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap);
|
||||
static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
@@ -786,6 +803,21 @@ static inline bool bpf_dump_raw_ok(void)
|
||||
struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
|
||||
const struct bpf_insn *patch, u32 len);
|
||||
|
||||
static inline int __xdp_generic_ok_fwd_dev(struct sk_buff *skb,
|
||||
struct net_device *fwd)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
if (unlikely(!(fwd->flags & IFF_UP)))
|
||||
return -ENETDOWN;
|
||||
|
||||
len = fwd->mtu + fwd->hard_header_len + VLAN_HLEN;
|
||||
if (skb->len > len)
|
||||
return -EMSGSIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The pair of xdp_do_redirect and xdp_do_flush_map MUST be called in the
|
||||
* same cpu context. Further for best results no more than a single map
|
||||
* for the do_redirect/do_flush pair should be used. This limitation is
|
||||
@@ -961,6 +993,9 @@ static inline void bpf_prog_kallsyms_del(struct bpf_prog *fp)
|
||||
}
|
||||
#endif /* CONFIG_BPF_JIT */
|
||||
|
||||
void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp);
|
||||
void bpf_prog_kallsyms_del_all(struct bpf_prog *fp);
|
||||
|
||||
#define BPF_ANC BIT(15)
|
||||
|
||||
static inline bool bpf_needs_clear_a(const struct sock_filter *first)
|
||||
|
Reference in New Issue
Block a user