Skip to content

Commit da3124e

Browse files
committed
ipv6: fix potential "struct net" leak in inet6_rtm_getaddr()
jira LE-1907 cve CVE-2024-27417 Rebuild_History Non-Buildable kernel-5.14.0-427.31.1.el9_4 commit-author Eric Dumazet <edumazet@google.com> commit 10bfd45 It seems that if userspace provides a correct IFA_TARGET_NETNSID value but no IFA_ADDRESS and IFA_LOCAL attributes, inet6_rtm_getaddr() returns -EINVAL with an elevated "struct net" refcount. Fixes: 6ecf4c3 ("ipv6: enable IFA_TARGET_NETNSID for RTM_GETADDR") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Christian Brauner <brauner@kernel.org> Cc: David Ahern <dsahern@kernel.org> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from commit 10bfd45) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 9428adf commit da3124e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

net/ipv6/addrconf.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5457,9 +5457,10 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh,
54575457
}
54585458

54595459
addr = extract_addr(tb[IFA_ADDRESS], tb[IFA_LOCAL], &peer);
5460-
if (!addr)
5461-
return -EINVAL;
5462-
5460+
if (!addr) {
5461+
err = -EINVAL;
5462+
goto errout;
5463+
}
54635464
ifm = nlmsg_data(nlh);
54645465
if (ifm->ifa_index)
54655466
dev = dev_get_by_index(tgt_net, ifm->ifa_index);

0 commit comments

Comments
 (0)