[PATCH v2] smackfs: fix IPv6 netlabel prefix mask for non-16-aligned lengths

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Nov 17 02:16:27 UTC 2026


> smk_write_net6addr() builds the partial-word mask as (1 << m) - 1,
> which keeps the low m bits instead of the high m bits (e.g. /33
> yields 0x0001 instead of 0x8000), and stores it without htons()
> while the address words are in network byte order. Any prefix with
> mask % 16 != 0 is truncated to the wrong network and mislabeled.
> 
> Take the high m bits and convert to network byte order, matching
> how newname words are stored with htons().
> 
> Fixes: 21abb1ec414c ("Smack: IPv6 host labeling")
> Signed-off-by: Hongjian Dai <daihongjian at kylinsec.com.cn>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/49DF0992E528A465+20261117021108.209924-1-daihongjian@kylinsec.com.cn?part=1




More information about the Linux-security-module-archive mailing list