summaryrefslogtreecommitdiff
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2019-02-23 10:12:45 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2019-02-23 10:12:45 +0100
commita99ac1920cdf2c5906d74b41f026f34194b512ea (patch)
tree582bb604c5ab9cd7865fed2303160feb317cb05e /drivers/net/vxlan.c
parentd93cfb73cdfc89c4e1a22297872b457fd7e99fd4 (diff)
parentaf13f43f01a3e4a11686f5fa4de42ecec8ed71b1 (diff)
Merge 4.4.176 into android-4.4-p
Changes in 4.4.176 net: fix IPv6 prefix route residue vsock: cope with memory allocation failure at socket creation time hwmon: (lm80) Fix missing unlock on error in set_fan_div() net: Fix for_each_netdev_feature on Big endian sky2: Increase D3 delay again net: Add header for usage of fls64() tcp: tcp_v4_err() should be more careful net: Do not allocate page fragments that are not skb aligned tcp: clear icsk_backoff in tcp_write_queue_purge() vxlan: test dev->flags & IFF_UP before calling netif_rx() net: stmmac: Fix a race in EEE enable callback net: ipv4: use a dedicated counter for icmp_v4 redirect packets x86: livepatch: Treat R_X86_64_PLT32 as R_X86_64_PC32 kvm: fix kvm_ioctl_create_device() reference counting (CVE-2019-6974) mfd: as3722: Handle interrupts on suspend mfd: as3722: Mark PM functions as __maybe_unused net/x25: do not hold the cpu too long in x25_new_lci() mISDN: fix a race in dev_expire_timer() ax25: fix possible use-after-free KVM: VMX: Fix x2apic check in vmx_msr_bitmap_mode() Linux 4.4.176 Change-Id: I82b10bb7d9692d4fe0386744934f09557d65ffe6 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index c41378214ede..553908adf3c5 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1881,7 +1881,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
struct pcpu_sw_netstats *tx_stats, *rx_stats;
union vxlan_addr loopback;
union vxlan_addr *remote_ip = &dst_vxlan->default_dst.remote_ip;
- struct net_device *dev = skb->dev;
+ struct net_device *dev;
int len = skb->len;
tx_stats = this_cpu_ptr(src_vxlan->dev->tstats);
@@ -1901,8 +1901,15 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
#endif
}
+ rcu_read_lock();
+ dev = skb->dev;
+ if (unlikely(!(dev->flags & IFF_UP))) {
+ kfree_skb(skb);
+ goto drop;
+ }
+
if (dst_vxlan->flags & VXLAN_F_LEARN)
- vxlan_snoop(skb->dev, &loopback, eth_hdr(skb)->h_source);
+ vxlan_snoop(dev, &loopback, eth_hdr(skb)->h_source);
u64_stats_update_begin(&tx_stats->syncp);
tx_stats->tx_packets++;
@@ -1915,8 +1922,10 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
rx_stats->rx_bytes += len;
u64_stats_update_end(&rx_stats->syncp);
} else {
+drop:
dev->stats.rx_dropped++;
}
+ rcu_read_unlock();
}
static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,