[PATCH net] ppp: annotate lockless queue empty check

Qingfang Deng <[email protected]>
Newsgroups org.kernel.vger.linux-ppp,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>
ppp_poll() checks whether pf->rq contains a packet without holding the
queue lock. skb_peek() requires appropriate locking or a private queue,
neither of which applies because ppp_input() can enqueue concurrently.

Only queue emptiness is needed, so use skb_queue_empty_lockless()
instead.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Qingfang Deng <[email protected]>
---
 drivers/net/ppp/ppp_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e1013621eb1d..1a610a18893b 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -556,7 +556,7 @@ static __poll_t ppp_poll(struct file *file, poll_table *wait)
 		return 0;
 	poll_wait(file, &pf->rwait, wait);
 	mask = EPOLLOUT | EPOLLWRNORM;
-	if (skb_peek(&pf->rq))
+	if (!skb_queue_empty_lockless(&pf->rq))
 		mask |= EPOLLIN | EPOLLRDNORM;
 	if (pf->dead)
 		mask |= EPOLLHUP;
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.