[PATCH net] netlabel: fix duplicate IPv4 entries in the staticlist dump
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Fri Nov 27 09:27:48 UTC 2026
> From: Linkui Xiao <xiaolinkui at kylinos.cn>
>
> netlbl_unlabel_staticlist() keeps its dump progress in cb->args[]: the
> bucket, the offset of the interface in that bucket, and the IPv4 and IPv6
> offsets in that interface. It clears iter_addr4 once the whole IPv4 list
> of an interface has been walked, so if the skb fills up while the IPv6
> list of the same interface is being dumped, cb->args[2] is saved as zero.
> The next round resumes on that interface and dumps its IPv4 entries a
> second time, which shows up as duplicated lines in "netlbl_unlabel -l".
>
> This needs an interface that carries both IPv4 and IPv6 static entries and
> a configuration large enough for the dump to span more than one netlink
> message, but once it does the duplication is reproducible on every dump.
>
> Clear both address counters when an interface is started instead of when
> it is finished. The skip counters still have to be cleared only after
> their own list has been walked in full, otherwise the offset saved for the
> interface where the previous dump stopped would also be applied to the
> interfaces that follow it.
>
> netlbl_unlabel_staticlistdef() dumps a single interface and never resets
> these counters, so it is not affected.
>
> Fixes: 866358ec331f ("netlabel: fix our progress tracking in netlbl_unlabel_staticlist()")
> Signed-off-by: Linkui Xiao <xiaolinkui at kylinos.cn>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127092325.3563681-2-xiaolinkui@126.com?part=1
More information about the Linux-security-module-archive
mailing list