[Devel] [PATCH hci-8.2 v2 10/15] ms/netlabel: validate unlabeled address and mask attribute lengths

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Tue Dec 1 18:42:13 MSK 2026


> From: Chenguang Zhao <zhaochenguang at kylinos.cn>
> 
> [ Upstream commit 9772589b57e44aedc240211c5c3f7a684a034d3a ]
> 
> netlbl_unlabel_addrinfo_get() used the address attribute length to
> determine whether the attribute data could be read as an IPv4 or IPv6
> address, but did not independently validate the corresponding mask
> attribute length.  A crafted Generic Netlink request could therefore
> provide a valid IPv4/IPv6 address attribute with a shorter mask
> attribute, which would later be read as a full struct in_addr or
> struct in6_addr.
> 
> NLA_BINARY policy lengths are maximum lengths by default, so use
> NLA_POLICY_EXACT_LEN() for the unlabeled IPv4/IPv6 address and mask
> attributes.  This rejects short attributes during policy validation and
> also exposes the exact length requirements through policy introspection.
> 
> Fixes: 8cc44579d1bd ("NetLabel: Introduce static network labels for unlabeled connections")
> Signed-off-by: Chenguang Zhao <zhaochenguang at kylinos.cn>
> Signed-off-by: Jakub Kicinski <kuba at kernel.org>
> Signed-off-by: Sasha Levin <sashal at kernel.org>
> (cherry picked from commit 71c52da13c3737493b42d20d9f33de34e03b3156)
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-158163
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply at sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261201153749.2872789-1-eva.kurchatova@virtuozzo.com?part=10




More information about the Devel mailing list