Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xsk: fix poll/POLLIN premature returns

Polling for the ingress queues relies on reading the producer/consumer
pointers of the Rx queue.

Prior this commit, a cached consumer pointer could be used, instead of
the actual consumer pointer and therefore report POLLIN prematurely.

This patch makes sure that the non-cached consumer pointer is used
instead.

Reported-by: Qi Zhang <qi.z.zhang@intel.com>
Tested-by: Qi Zhang <qi.z.zhang@intel.com>
Fixes: c497176cb2e4 ("xsk: add Rx receive functions and poll support")
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

authored by

Björn Töpel and committed by
Daniel Borkmann
d24458e4 9e4e5b5c

+1 -1
+1 -1
net/xdp/xsk_queue.h
··· 250 250 251 251 static inline bool xskq_empty_desc(struct xsk_queue *q) 252 252 { 253 - return xskq_nb_free(q, q->prod_tail, 1) == q->nentries; 253 + return xskq_nb_free(q, q->prod_tail, q->nentries) == q->nentries; 254 254 } 255 255 256 256 void xskq_set_umem(struct xsk_queue *q, struct xdp_umem_props *umem_props);