diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2018-01-26 01:36:32 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-29 12:02:54 -0500 |
commit | 84328342a70a44379dd73011a44c5f5e00481a42 (patch) | |
tree | 6632999881c596c3fa989da3e062ef1fdb07dfcf /include/linux/ptr_ring.h | |
parent | 88fae87327a2261cf8db078f6ce4e5a3e55b30b1 (diff) | |
download | lwn-84328342a70a44379dd73011a44c5f5e00481a42.tar.gz lwn-84328342a70a44379dd73011a44c5f5e00481a42.zip |
ptr_ring: disallow lockless __ptr_ring_full
Similar to bcecb4bbf88a ("net: ptr_ring: otherwise safe empty checks can
overrun array bounds") a lockless use of __ptr_ring_full might
cause an out of bounds access.
We can fix this, but it's easier to just disallow lockless
__ptr_ring_full for now.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/ptr_ring.h')
-rw-r--r-- | include/linux/ptr_ring.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h index 9a72d8fec50e..f17584680b79 100644 --- a/include/linux/ptr_ring.h +++ b/include/linux/ptr_ring.h @@ -45,9 +45,10 @@ struct ptr_ring { }; /* Note: callers invoking this in a loop must use a compiler barrier, - * for example cpu_relax(). If ring is ever resized, callers must hold - * producer_lock - see e.g. ptr_ring_full. Otherwise, if callers don't hold - * producer_lock, the next call to __ptr_ring_produce may fail. + * for example cpu_relax(). + * + * NB: this is unlike __ptr_ring_empty in that callers must hold producer_lock: + * see e.g. ptr_ring_full. */ static inline bool __ptr_ring_full(struct ptr_ring *r) { |