diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-12-15 16:08:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-12-15 16:08:37 -0500 |
commit | 7a3c296ae08f9b51e399074d8ef6867d65fbd22b (patch) | |
tree | b8f9eef7b2c5db64f5f977f67edd7cfaaaeb8a89 /include/linux/ptr_ring.h | |
parent | c36c7a7c4034f2ef35c6aa6821e7c82d9968dba4 (diff) | |
parent | 043ee1debd0b29c16c4c4b11a348ca667bfe9144 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller:
1) Clamp timeouts to INT_MAX in conntrack, from Jay Elliot.
2) Fix broken UAPI for BPF_PROG_TYPE_PERF_EVENT, from Hendrik
Brueckner.
3) Fix locking in ieee80211_sta_tear_down_BA_sessions, from Johannes
Berg.
4) Add missing barriers to ptr_ring, from Michael S. Tsirkin.
5) Don't advertise gigabit in sh_eth when not available, from Thomas
Petazzoni.
6) Check network namespace when delivering to netlink taps, from Kevin
Cernekee.
7) Kill a race in raw_sendmsg(), from Mohamed Ghannam.
8) Use correct address in TCP md5 lookups when replying to an incoming
segment, from Christoph Paasch.
9) Add schedule points to BPF map alloc/free, from Eric Dumazet.
10) Don't allow silly mtu values to be used in ipv4/ipv6 multicast, also
from Eric Dumazet.
11) Fix SKB leak in tipc, from Jon Maloy.
12) Disable MAC learning on OVS ports of mlxsw, from Yuval Mintz.
13) SKB leak fix in skB_complete_tx_timestamp(), from Willem de Bruijn.
14) Add some new qmi_wwan device IDs, from Daniele Palmas.
15) Fix static key imbalance in ingress qdisc, from Jiri Pirko.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (76 commits)
net: qcom/emac: Reduce timeout for mdio read/write
net: sched: fix static key imbalance in case of ingress/clsact_init error
net: sched: fix clsact init error path
ip_gre: fix wrong return value of erspan_rcv
net: usb: qmi_wwan: add Telit ME910 PID 0x1101 support
pkt_sched: Remove TC_RED_OFFLOADED from uapi
net: sched: Move to new offload indication in RED
net: sched: Add TCA_HW_OFFLOAD
net: aquantia: Increment driver version
net: aquantia: Fix typo in ethtool statistics names
net: aquantia: Update hw counters on hw init
net: aquantia: Improve link state and statistics check interval callback
net: aquantia: Fill in multicast counter in ndev stats from hardware
net: aquantia: Fill ndev stat couters from hardware
net: aquantia: Extend stat counters to 64bit values
net: aquantia: Fix hardware DMA stream overload on large MRRS
net: aquantia: Fix actual speed capabilities reporting
sock: free skb in skb_complete_tx_timestamp on error
s390/qeth: update takeover IPs after configuration change
s390/qeth: lock IP table while applying takeover changes
...
Diffstat (limited to 'include/linux/ptr_ring.h')
-rw-r--r-- | include/linux/ptr_ring.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h index 37b4bb2545b3..6866df4f31b5 100644 --- a/include/linux/ptr_ring.h +++ b/include/linux/ptr_ring.h | |||
@@ -101,12 +101,18 @@ static inline bool ptr_ring_full_bh(struct ptr_ring *r) | |||
101 | 101 | ||
102 | /* Note: callers invoking this in a loop must use a compiler barrier, | 102 | /* Note: callers invoking this in a loop must use a compiler barrier, |
103 | * for example cpu_relax(). Callers must hold producer_lock. | 103 | * for example cpu_relax(). Callers must hold producer_lock. |
104 | * Callers are responsible for making sure pointer that is being queued | ||
105 | * points to a valid data. | ||
104 | */ | 106 | */ |
105 | static inline int __ptr_ring_produce(struct ptr_ring *r, void *ptr) | 107 | static inline int __ptr_ring_produce(struct ptr_ring *r, void *ptr) |
106 | { | 108 | { |
107 | if (unlikely(!r->size) || r->queue[r->producer]) | 109 | if (unlikely(!r->size) || r->queue[r->producer]) |
108 | return -ENOSPC; | 110 | return -ENOSPC; |
109 | 111 | ||
112 | /* Make sure the pointer we are storing points to a valid data. */ | ||
113 | /* Pairs with smp_read_barrier_depends in __ptr_ring_consume. */ | ||
114 | smp_wmb(); | ||
115 | |||
110 | r->queue[r->producer++] = ptr; | 116 | r->queue[r->producer++] = ptr; |
111 | if (unlikely(r->producer >= r->size)) | 117 | if (unlikely(r->producer >= r->size)) |
112 | r->producer = 0; | 118 | r->producer = 0; |
@@ -275,6 +281,9 @@ static inline void *__ptr_ring_consume(struct ptr_ring *r) | |||
275 | if (ptr) | 281 | if (ptr) |
276 | __ptr_ring_discard_one(r); | 282 | __ptr_ring_discard_one(r); |
277 | 283 | ||
284 | /* Make sure anyone accessing data through the pointer is up to date. */ | ||
285 | /* Pairs with smp_wmb in __ptr_ring_produce. */ | ||
286 | smp_read_barrier_depends(); | ||
278 | return ptr; | 287 | return ptr; |
279 | } | 288 | } |
280 | 289 | ||