[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM_iQpW6UfborPC6Qh8+Lp4fQQSOjA+HOHtKsmP6oos655HsaQ@mail.gmail.com>
Date: Mon, 13 Jul 2020 23:19:47 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Thomas Habets <thomas@...ets.se>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
Ralf Baechle <ralf@...ux-mips.org>
Subject: Re: PATCH ax25: Don't hold skb lock while doing blocking read
On Thu, Jul 9, 2020 at 12:53 PM Thomas Habets <thomas@...ets.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.
Powered by blists - more mailing lists