Messages in this thread | | | From | Eric Dumazet <> | Date | Tue, 14 Jun 2022 07:47:34 -0700 | Subject | Re: [PATCH net v5] net: ax25: Fix deadlock caused by skb_recv_datagram in ax25_recvmsg |
| |
On Tue, Jun 14, 2022 at 2:26 AM Duoming Zhou <duoming@zju.edu.cn> wrote: > > The skb_recv_datagram() in ax25_recvmsg() will hold lock_sock > and block until it receives a packet from the remote. If the client > doesn`t connect to server and calls read() directly, it will not > receive any packets forever. As a result, the deadlock will happen. > > The fail log caused by deadlock is shown below: > > This patch replaces skb_recv_datagram() with an open-coded variant of it > releasing the socket lock before the __skb_wait_for_more_packets() call > and re-acquiring it after such call in order that other functions that > need socket lock could be executed. > > what's more, the socket lock will be released only when recvmsg() will > block and that should produce nicer overall behavior. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Suggested-by: Thomas Osterried <thomas@osterried.de> > Signed-off-by: Duoming Zhou <duoming@zju.edu.cn> > Reported-by: Thomas Habets <thomas@@habets.se> > Acked-by: Paolo Abeni <pabeni@redhat.com> > ---
Reviewed-by: Eric Dumazet <edumazet@google.com>
| |