Commit d9a432d4 authored by Richard Haines's avatar Richard Haines Committed by Khalid Elmously

netlabel: If PF_INET6, check sk_buff ip header version

BugLink: https://bugs.launchpad.net/bugs/1775771

[ Upstream commit 213d7f94 ]

When resolving a fallback label, check the sk_buff version as it
is possible (e.g. SCTP) to have family = PF_INET6 while
receiving ip_hdr(skb)->version = 4.
Signed-off-by: default avatarRichard Haines <richard_c_haines@btinternet.com>
Acked-by: default avatarPaul Moore <paul@paul-moore.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 4bf2869f
...@@ -1469,6 +1469,16 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb, ...@@ -1469,6 +1469,16 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
iface = rcu_dereference(netlbl_unlhsh_def); iface = rcu_dereference(netlbl_unlhsh_def);
if (iface == NULL || !iface->valid) if (iface == NULL || !iface->valid)
goto unlabel_getattr_nolabel; goto unlabel_getattr_nolabel;
#if IS_ENABLED(CONFIG_IPV6)
/* When resolving a fallback label, check the sk_buff version as
* it is possible (e.g. SCTP) to have family = PF_INET6 while
* receiving ip_hdr(skb)->version = 4.
*/
if (family == PF_INET6 && ip_hdr(skb)->version == 4)
family = PF_INET;
#endif /* IPv6 */
switch (family) { switch (family) {
case PF_INET: { case PF_INET: {
struct iphdr *hdr4; struct iphdr *hdr4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment