mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 17:23:55 +08:00
Merge branch 'smack-for-5.2-b' of https://github.com/cschaufler/next-smack into next-smack
Smack: Fix IPv6 handling of 0 secmark (2019-04-03 14:28:38 -0700)
This commit is contained in:
commit
5f9b4992b7
@ -2806,13 +2806,17 @@ static int smack_socket_socketpair(struct socket *socka,
|
|||||||
*
|
*
|
||||||
* Records the label bound to a port.
|
* Records the label bound to a port.
|
||||||
*
|
*
|
||||||
* Returns 0
|
* Returns 0 on success, and error code otherwise
|
||||||
*/
|
*/
|
||||||
static int smack_socket_bind(struct socket *sock, struct sockaddr *address,
|
static int smack_socket_bind(struct socket *sock, struct sockaddr *address,
|
||||||
int addrlen)
|
int addrlen)
|
||||||
{
|
{
|
||||||
if (sock->sk != NULL && sock->sk->sk_family == PF_INET6)
|
if (sock->sk != NULL && sock->sk->sk_family == PF_INET6) {
|
||||||
|
if (addrlen < SIN6_LEN_RFC2133 ||
|
||||||
|
address->sa_family != AF_INET6)
|
||||||
|
return -EINVAL;
|
||||||
smk_ipv6_port_label(sock, address);
|
smk_ipv6_port_label(sock, address);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* SMACK_IPV6_PORT_LABELING */
|
#endif /* SMACK_IPV6_PORT_LABELING */
|
||||||
@ -2848,12 +2852,13 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap,
|
|||||||
|
|
||||||
switch (sock->sk->sk_family) {
|
switch (sock->sk->sk_family) {
|
||||||
case PF_INET:
|
case PF_INET:
|
||||||
if (addrlen < sizeof(struct sockaddr_in))
|
if (addrlen < sizeof(struct sockaddr_in) ||
|
||||||
|
sap->sa_family != AF_INET)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
rc = smack_netlabel_send(sock->sk, (struct sockaddr_in *)sap);
|
rc = smack_netlabel_send(sock->sk, (struct sockaddr_in *)sap);
|
||||||
break;
|
break;
|
||||||
case PF_INET6:
|
case PF_INET6:
|
||||||
if (addrlen < sizeof(struct sockaddr_in6))
|
if (addrlen < SIN6_LEN_RFC2133 || sap->sa_family != AF_INET6)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
#ifdef SMACK_IPV6_SECMARK_LABELING
|
#ifdef SMACK_IPV6_SECMARK_LABELING
|
||||||
rsp = smack_ipv6host_label(sip);
|
rsp = smack_ipv6host_label(sip);
|
||||||
@ -3683,9 +3688,15 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
|
|||||||
|
|
||||||
switch (sock->sk->sk_family) {
|
switch (sock->sk->sk_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
if (msg->msg_namelen < sizeof(struct sockaddr_in) ||
|
||||||
|
sip->sin_family != AF_INET)
|
||||||
|
return -EINVAL;
|
||||||
rc = smack_netlabel_send(sock->sk, sip);
|
rc = smack_netlabel_send(sock->sk, sip);
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
|
if (msg->msg_namelen < SIN6_LEN_RFC2133 ||
|
||||||
|
sap->sin6_family != AF_INET6)
|
||||||
|
return -EINVAL;
|
||||||
#ifdef SMACK_IPV6_SECMARK_LABELING
|
#ifdef SMACK_IPV6_SECMARK_LABELING
|
||||||
rsp = smack_ipv6host_label(sap);
|
rsp = smack_ipv6host_label(sap);
|
||||||
if (rsp != NULL)
|
if (rsp != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user