diff options
author | Richard Haines <richard_c_haines@btinternet.com> | 2017-11-13 15:54:22 -0500 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2018-02-14 14:01:41 -0500 |
commit | 213d7f94775322ba44e0bbb55ec6946e9de88cea (patch) | |
tree | daac5442060f3e2f198ed341cebf344edfc0bdc6 /net | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
netlabel: If PF_INET6, check sk_buff ip header version
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: Richard Haines <richard_c_haines@btinternet.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/netlabel/netlabel_unlabeled.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 22dc1b9d6362..c070dfc0190a 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1472,6 +1472,16 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb, | |||
1472 | iface = rcu_dereference(netlbl_unlhsh_def); | 1472 | iface = rcu_dereference(netlbl_unlhsh_def); |
1473 | if (iface == NULL || !iface->valid) | 1473 | if (iface == NULL || !iface->valid) |
1474 | goto unlabel_getattr_nolabel; | 1474 | goto unlabel_getattr_nolabel; |
1475 | |||
1476 | #if IS_ENABLED(CONFIG_IPV6) | ||
1477 | /* When resolving a fallback label, check the sk_buff version as | ||
1478 | * it is possible (e.g. SCTP) to have family = PF_INET6 while | ||
1479 | * receiving ip_hdr(skb)->version = 4. | ||
1480 | */ | ||
1481 | if (family == PF_INET6 && ip_hdr(skb)->version == 4) | ||
1482 | family = PF_INET; | ||
1483 | #endif /* IPv6 */ | ||
1484 | |||
1475 | switch (family) { | 1485 | switch (family) { |
1476 | case PF_INET: { | 1486 | case PF_INET: { |
1477 | struct iphdr *hdr4; | 1487 | struct iphdr *hdr4; |