From: Piotr Sawicki 
Date: Thu, 19 Jul 2018 09:45:16 +0000 (+0200)
Subject: Smack: Check UDP-Lite and DCCP protocols during IPv6 handling
X-Git-Tag: v4.19-rc1~126^2^2~1
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a07ef9516477aef2d052d75129a48f9f94d3b3f3;p=linux-platform-drivers-x86.git
Smack: Check UDP-Lite and DCCP protocols during IPv6 handling
The smack_socket_sock_rcv_skb() function is checking smack labels
only for UDP and TCP frames carried in IPv6 packets. From now on,
it is able also to handle UDP-Lite and DCCP protocols.
Signed-off-by: Piotr Sawicki 
Signed-off-by: Casey Schaufler 
---
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index c4feb954d53f..aff8397e8c7e 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -3895,6 +3895,7 @@ static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr_in6 *sip)
 			sip->sin6_port = th->source;
 		break;
 	case IPPROTO_UDP:
+	case IPPROTO_UDPLITE:
 		uh = skb_header_pointer(skb, offset, sizeof(_udph), &_udph);
 		if (uh != NULL)
 			sip->sin6_port = uh->source;
@@ -3985,7 +3986,8 @@ access_check:
 #if IS_ENABLED(CONFIG_IPV6)
 	case PF_INET6:
 		proto = smk_skb_to_addr_ipv6(skb, &sadd);
-		if (proto != IPPROTO_UDP && proto != IPPROTO_TCP)
+		if (proto != IPPROTO_UDP && proto != IPPROTO_UDPLITE &&
+		    proto != IPPROTO_TCP && proto != IPPROTO_DCCP)
 			break;
 #ifdef SMACK_IPV6_SECMARK_LABELING
 		if (skb && skb->secmark != 0)