Merge head 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
[pandora-kernel.git] / security / selinux / hooks.c
index 17a1189..2253f38 100644 (file)
@@ -68,6 +68,7 @@
 #include <linux/personality.h>
 #include <linux/sysctl.h>
 #include <linux/audit.h>
+#include <linux/string.h>
 
 #include "avc.h"
 #include "objsec.h"
@@ -825,7 +826,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
                        sid = sbsec->def_sid;
                        rc = 0;
                } else {
-                       rc = security_context_to_sid(context, rc, &sid);
+                       rc = security_context_to_sid_default(context, rc, &sid,
+                                                            sbsec->def_sid);
                        if (rc) {
                                printk(KERN_WARNING "%s:  context_to_sid(%s) "
                                       "returned %d for dev=%s ino=%ld\n",
@@ -1943,7 +1945,7 @@ static int selinux_sb_copy_data(struct file_system_type *type, void *orig, void
                }
        } while (*in_end++);
 
-       copy_page(in_save, nosec_save);
+       strcpy(in_save, nosec_save);
        free_page((unsigned long)nosec_save);
 out:
        return rc;
@@ -3124,12 +3126,12 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address,
 
                if (sk->sk_family == PF_INET) {
                        addr4 = (struct sockaddr_in *)address;
-                       if (addrlen != sizeof(struct sockaddr_in))
+                       if (addrlen < sizeof(struct sockaddr_in))
                                return -EINVAL;
                        snum = ntohs(addr4->sin_port);
                } else {
                        addr6 = (struct sockaddr_in6 *)address;
-                       if (addrlen != sizeof(struct sockaddr_in6))
+                       if (addrlen < SIN6_LEN_RFC2133)
                                return -EINVAL;
                        snum = ntohs(addr6->sin6_port);
                }