Re: [PATCH net v2 2/3] udp: Ignore a connect()-set device in the bind conflict check

From: Juan Agustin Niccolini

Date: Wed Dec 02 2026 - 01:17:32 EST


> - [High] The fix covers UDP but not L2TP-over-IPv6, which has the same
> bug.
Duplicate of the one raised on patch 1. Preexisting issue.

> - [Medium] The commit message presents the cross-user takeover as closed,
> but the same victim sequence still allows an equivalent takeover…

Addressed in note 2 of this patch:

"- connect() also narrows the local address of a wildcard-bound
socket, which opens the same window through the address. It is not
fixed here: connect() moves the socket to the secondary hash slot of
the narrowed address, so a specific-address bind on a busy port never
scans it. Closing that needs either a full scan on every bind or no
rehash on connect, which slows down binds or lookups on busy ports,
so I leave it for a separate patch."


> - [Medium] The patch changed udp_sk_reuseport_match() to compare dif2 =
> udp_bound_dev_if(sk2), the device bind() reserved, which is 0 for a…

This only happens on top of the case documented on note 2 and does
not add anything. Severity is none.

> - [Medium] udp_bound_dev_if() reads another socket's SOCK_CONNECT_DEV
> flag, then its sk_bound_dev_if, then the flag again, without that…

Addressed in note 1 of this patch, though the window is wider than
"within two loads" says.

The case in the commit message cannot race: connect() of a
wildcard-bound socket rehashes it under hslot->lock, which the bind
scan holds, so the device cannot be set and cleared during the scan.
What is left is a connect() that fails and rolls back, and a socket
bound to a specific address.