On Thu, Jul 9, 2020 at 12:53 PM Thomas Habets <tho...@habets.se> wrote: > > Here's a test program that illustrates the problem: > https://github.com/ThomasHabets/radiostuff/blob/master/ax25/axftp/examples/client_lockcheck.cc > > Before this patch, this hangs, because the read(2) blocks the > write(2). > > I see that calling skb_recv_datagram without this lock is done in > pep_sock_accept() and atalk_recvmsg() and others, which is what makes > me think it's safe to do here too. But I'm far from an expert on skb > lock semantics.
A proper fix here is just to release the sock lock before going to sleep in __skb_wait_for_more_packets(). You can take a look at how sk_wait_event() handles this. Of course, not all callers call it with sock lock, so it needs some additional work. Thanks.