aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 5e755a3f4cae..9f9463000683 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -826,7 +826,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
826 sid = sbsec->def_sid; 826 sid = sbsec->def_sid;
827 rc = 0; 827 rc = 0;
828 } else { 828 } else {
829 rc = security_context_to_sid(context, rc, &sid); 829 rc = security_context_to_sid_default(context, rc, &sid,
830 sbsec->def_sid);
830 if (rc) { 831 if (rc) {
831 printk(KERN_WARNING "%s: context_to_sid(%s) " 832 printk(KERN_WARNING "%s: context_to_sid(%s) "
832 "returned %d for dev=%s ino=%ld\n", 833 "returned %d for dev=%s ino=%ld\n",
@@ -3125,12 +3126,12 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address,
3125 3126
3126 if (sk->sk_family == PF_INET) { 3127 if (sk->sk_family == PF_INET) {
3127 addr4 = (struct sockaddr_in *)address; 3128 addr4 = (struct sockaddr_in *)address;
3128 if (addrlen != sizeof(struct sockaddr_in)) 3129 if (addrlen < sizeof(struct sockaddr_in))
3129 return -EINVAL; 3130 return -EINVAL;
3130 snum = ntohs(addr4->sin_port); 3131 snum = ntohs(addr4->sin_port);
3131 } else { 3132 } else {
3132 addr6 = (struct sockaddr_in6 *)address; 3133 addr6 = (struct sockaddr_in6 *)address;
3133 if (addrlen != sizeof(struct sockaddr_in6)) 3134 if (addrlen < SIN6_LEN_RFC2133)
3134 return -EINVAL; 3135 return -EINVAL;
3135 snum = ntohs(addr6->sin6_port); 3136 snum = ntohs(addr6->sin6_port);
3136 } 3137 }