Re: [PATCH net,v2] tcp: fix forever orphan socket caused by tcp_abort

From: Jason Xing
Date: Wed Aug 14 2024 - 04:39:45 EST


On Wed, Aug 14, 2024 at 3:35 PM Lorenzo Colitti <lorenzo@xxxxxxxxxx> wrote:
>
> On Mon, Aug 12, 2024 at 7:53 PM Xueming Feng <kuro@xxxxxxxx> wrote:
> > The -ENOENT code comes from the associate patch Lorenzo made for
> > iproute2-ss; link attached below.
>
> ENOENT does seem reasonable. It's the same thing that would happen if
> userspace passed in a nonexistent cookie (we have a test for that).
> I'd guess this could happen if userspace was trying to destroy a
> socket but it lost the race against the process owning a socket
> closing it?
>
> > bh_unlock_sock(sk);
> > local_bh_enable();
> > - tcp_write_queue_purge(sk);
>
> Is this not necessary in any other cases? What if there is
> retransmitted data, shouldn't that be cleared?

This line is duplicated, please see
tcp_done_with_error()->tcp_write_queue_purge().

Thanks,
Jason