aboutsummaryrefslogtreecommitdiff
path: root/net/packet/af_packet.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2015-08-14 09:36:42 -0700
committerKevin Hilman <khilman@linaro.org>2015-08-14 09:36:42 -0700
commit07818b5b1ba0f494a7255ab634bad2dd2b908ed0 (patch)
treefb1045fb0f610b29c3a631bcd22df69ca095e241 /net/packet/af_packet.c
parent65fa7c7f66d9a33fe13e426f86b8bb8824334a92 (diff)
parent78fb9f4236d9077fb343fb5a4e55fe27075e9a1d (diff)
Merge tag 'v3.10.86' into linux-linaro-lsk-v3.10lsk-v3.10-15.08
This is the 3.10.86 stable release * tag 'v3.10.86': (132 commits) Linux 3.10.86 efi: fix 32bit kernel boot failed problem using efi iscsi-target: Fix iser explicit logout TX kthread leak iscsi-target: Fix use-after-free during TPG session shutdown vhost: actually track log eventfd file rds: rds_ib_device.refcount overflow xhci: prevent bus_suspend if SS port resuming in phase 1 xhci: report U3 when link is in resume state xhci: Calculate old endpoints correctly on device reset usb-storage: ignore ZTE MF 823 card reader in mode 0x1225 ata: pmp: add quirk for Marvell 4140 SATA PMP blkcg: fix gendisk reference leak in blkg_conf_prep() Input: usbtouchscreen - avoid unresponsive TSC-30 touch screen tile: use free_bootmem_late() for initrd md/raid1: fix test for 'was read error from last working device'. mmc: sdhci-pxav3: fix platform_data is not initialized mmc: sdhci-esdhc: Make 8BIT bus work mac80211: clear subdir_stations when removing debugfs st: null pointer dereference panic caused by use after kref_put by st_open ALSA: hda - Fix MacBook Pro 5,2 quirk ...
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r--net/packet/af_packet.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 81b4b816f131..39fa33969b09 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1150,16 +1150,6 @@ static void packet_sock_destruct(struct sock *sk)
sk_refcnt_debug_dec(sk);
}
-static int fanout_rr_next(struct packet_fanout *f, unsigned int num)
-{
- int x = atomic_read(&f->rr_cur) + 1;
-
- if (x >= num)
- x = 0;
-
- return x;
-}
-
static unsigned int fanout_demux_hash(struct packet_fanout *f,
struct sk_buff *skb,
unsigned int num)
@@ -1171,13 +1161,9 @@ static unsigned int fanout_demux_lb(struct packet_fanout *f,
struct sk_buff *skb,
unsigned int num)
{
- int cur, old;
+ unsigned int val = atomic_inc_return(&f->rr_cur);
- cur = atomic_read(&f->rr_cur);
- while ((old = atomic_cmpxchg(&f->rr_cur, cur,
- fanout_rr_next(f, num))) != cur)
- cur = old;
- return cur;
+ return val % num;
}
static unsigned int fanout_demux_cpu(struct packet_fanout *f,
@@ -1217,7 +1203,7 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev)
{
struct packet_fanout *f = pt->af_packet_priv;
- unsigned int num = f->num_members;
+ unsigned int num = ACCESS_ONCE(f->num_members);
struct packet_sock *po;
unsigned int idx;