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

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Sep 22 14:57:36 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")

Sashiko has reviewed this patch and found no issues. It looks great!

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




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