]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ipv6: ndisc: fix ndisc_ra_useropt to initialize nduseropt_padX fields to zero...
authorYochai Eisenrich <echelonh@gmail.com>
Tue, 24 Mar 2026 22:49:25 +0000 (00:49 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Mar 2026 03:38:35 +0000 (20:38 -0700)
When processing Router Advertisements with user options the kernel
builds an RTM_NEWNDUSEROPT netlink message. The nduseroptmsg struct
has three padding fields that are never zeroed and can leak kernel data

The fix is simple, just zeroes the padding fields.

Fixes: 31910575a9de ("[IPv6]: Export userland ND options through netlink (RDNSS support)")
Signed-off-by: Yochai Eisenrich <echelonh@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260324224925.2437775-1-echelonh@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv6/ndisc.c

index f6a5d8c73af9721741c11b543e5abeecdbf2079f..186e60c792145c2f2fdc06e82877d50a60e59212 100644 (file)
@@ -1209,6 +1209,9 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
        ndmsg->nduseropt_icmp_type = icmp6h->icmp6_type;
        ndmsg->nduseropt_icmp_code = icmp6h->icmp6_code;
        ndmsg->nduseropt_opts_len = opt->nd_opt_len << 3;
+       ndmsg->nduseropt_pad1 = 0;
+       ndmsg->nduseropt_pad2 = 0;
+       ndmsg->nduseropt_pad3 = 0;
 
        memcpy(ndmsg + 1, opt, opt->nd_opt_len << 3);