Skip to content

Commit

Permalink
netlabel: If PF_INET6, check sk_buff ip header version
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Richard Haines authored and Paul Moore committed Feb 14, 2018
1 parent 7928b2c commit 213d7f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions net/netlabel/netlabel_unlabeled.c
Original file line number Diff line number Diff line change
@@ -1472,6 +1472,16 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
iface = rcu_dereference(netlbl_unlhsh_def);
if (iface == NULL || !iface->valid)
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) {
case PF_INET: {
struct iphdr *hdr4;

0 comments on commit 213d7f9

Please sign in to comment.