]> git.hungrycats.org Git - linux/commit
ipv6: fix potential "struct net" leak in inet6_rtm_getaddr()
authorEric Dumazet <edumazet@google.com>
Thu, 22 Feb 2024 12:17:47 +0000 (12:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Mar 2024 14:38:45 +0000 (14:38 +0000)
commit8a54834c03c30e549c33d5da0975f3e1454ec906
treeb522dd5a1a5016bed351fda10dd7aba6ec4e840e
parentf011c103e654d83dc85f057a7d1bd0960d02831c
ipv6: fix potential "struct net" leak in inet6_rtm_getaddr()

[ Upstream commit 10bfd453da64a057bcfd1a49fb6b271c48653cdb ]

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: 6ecf4c37eb3e ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv6/addrconf.c