[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJEc4h2MrQewuK_2fjW5ibu3Y56LbnwbM7hKOEUUrNuHg@mail.gmail.com>
Date: Tue, 14 Jun 2022 07:47:34 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Duoming Zhou <duoming@....edu.cn>
Cc: linux-hams@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>,
jreuter@...na.de, Ralf Baechle <ralf@...ux-mips.org>,
David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, thomas@...erried.de
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@....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@...erried.de>
> Signed-off-by: Duoming Zhou <duoming@....edu.cn>
> Reported-by: Thomas Habets <thomas@@habets.se>
> Acked-by: Paolo Abeni <pabeni@...hat.com>
> ---
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Powered by blists - more mailing lists