Re: [PATCH net] tcp: fix device binding after failed IPv6 connect

From: Xia Yan

Date: Mon Nov 02 2026 - 09:49:36 EST


Hi Jiayuan,

> Reverse xmas tree please

Done in v2.

> inet_bhash2_reset_saddr uses sk_bound_dev_if too.

Agreed. v2 restores it before tcp_set_state(TCP_CLOSE) and
inet_bhash2_reset_saddr(). I reproduced the bind2 warning with v1 in
the VRF test; it's gone with v2.

v2 also restores only a scope binding installed by this call and keeps
a different binding set by a later callback. It avoids restoring again
after the TCP_CLOSE callback. The UML tests cover both VRF cleanup and
BPF binding changes; all 39 checks pass with v2.

On the asynchronous failures from the bot review: those go through
disconnect after tcp_v6_connect() has returned successfully. Retaining
the binding there predates v1. Handling it would mean tracking the
implicit binding across disconnect; v2 is limited to synchronous
connect errors and makes that scope explicit in the commit message.

Thanks for the review. I'll send v2 as a separate thread.

Best regards,
Xia Yan

pw-bot: cr