Re: [PATCH net v3] net: unix: reject negative max_dgram_qlen values

From: kuniyu

Date: Sat Oct 17 2026 - 01:04:53 EST


On Fri, 16 Oct 2026 11:02:58 +0800, Yingjie Wang wrote:
> net.unix.max_dgram_qlen is parsed as a signed int and copied to the u32
> sock::sk_max_ack_backlog when an AF_UNIX socket is created. Consequently,
> a negative value such as -1 is accepted and converted to UINT_MAX. Since
> the receive queue length is also u32, its fullness check cannot become true
> for that limit.
>
> max_dgram_qlen has no documented negative sentinel. Its existing signed
> interface represents nonnegative values only through INT_MAX; negative bit
> patterns are not a supported encoding for the upper half of the u32
> consumer range.
>
> Switch to proc_dointvec_minmax and make the established 0..INT_MAX input
> range explicit. This rejects negative values without adding new accepted
> values or changing the default and zero-value behavior. Very large valid
> values can still make the queue limit impractical to reach; this change
> corrects the input domain rather than imposing a new resource ceiling.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: Codex:gpt-5
> Signed-off-by: Yingjie Wang <1075151112@xxxxxx>

Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>