Re: [PATCH net-next 1/3] net: qrtr: do not take the sock lock on blocking recv
From: Manivannan Sadhasivam
Date: Mon Oct 26 2026 - 08:55:11 EST
On Fri, Oct 16, 2026 at 01:58:18AM -0700, Chunkai Deng wrote:
> qrtr_recvmsg() takes lock_sock() before skb_recv_datagram() and keeps it
> while waiting for a datagram. Any other call on the same socket, such as
> sendmsg(), bind() or ioctl(), blocks until a packet arrives.
>
> Take the lock only once a datagram has been dequeued. The receive queue
> has its own lock and the enqueue path never takes the socket lock. The
> lock is still needed around the copy and skb_free_datagram(), since
> TIOCINQ peeks the queue under lock_sock() only.
>
> Testing SOCK_ZAPPED without the lock means a recv() racing with bind()
> may return -EADDRNOTAVAIL for a port that was just published. There is
> no ordering between the two calls anyway.
>
> Signed-off-by: Chunkai Deng <chunkai.deng@xxxxxxxxxxxxxxxx>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
- Mani
--
மணிவண்ணன் சதாசிவம்