> Handle the TCP_ESTABLISHED -> TCP_CLOSING transition on OP_RST, which can
> race with the connect loop. Immediately break and return 0 on
> ESTABLISHED/CLOSING. The return value of connect() should reflect what
> happened up to the point the connection was established or failed. Events
> that occur afterwards must not affect it. E.g. even if OP_RW has already
> set sk_err, connect() should still return 0, not ENOBUFS because of it.
> Adapt the inaccurate comment above signal_pending().
>
> Resetting a socket that is still present in connected_table can lead to
> memory corruption. The reporter noted lost transports for in-flight skbs,
> and I have reproduced crashes caused by re-insertion into connected_table.
>
> list_add double add: new=, prev=, next=.
> kernel BUG at lib/list_debug.c:35!
> Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
> [ ... ]
>
> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
> Reported-by: Hyunwoo Kim <[email protected]>
> Link: https://lore.kernel.org/netdev/anzT1fREOSyHT99k@v4bel/
> Signed-off-by: Michal Luczaj <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review ยท
https://sashiko.dev/#/patchset/[email protected]?part=1