]> git.baikalelectronics.ru Git - kernel.git/commit
ptr_ring: keep consumer_head valid at all times
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 25 Jan 2018 23:36:27 +0000 (01:36 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Jan 2018 17:02:53 +0000 (12:02 -0500)
commitb1438aa6185987daf898322994c2b9ffef8b28f9
tree8f440597d97aade025b56f2127d0a39bb60fd124
parenta9e32091af8925b6b0050ab0d0cc9bbec53eedd8
ptr_ring: keep consumer_head valid at all times

The comment near __ptr_ring_peek says:

 * If ring is never resized, and if the pointer is merely
 * tested, there's no need to take the lock - see e.g.  __ptr_ring_empty.

but this was in fact never possible since consumer_head would sometimes
point outside the ring. Refactor the code so that it's always
pointing within a ring.

Fixes: 0ad787760556a ("net: sched: pfifo_fast use skb_array")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/ptr_ring.h