net: Remove meaningless jump label out_fs
[linux-2.6-microblaze.git] / net / compat.c
index 77f3a0e..703acb5 100644 (file)
@@ -330,120 +330,6 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
        __scm_destroy(scm);
 }
 
-/* allocate a 64-bit sock_fprog on the user stack for duration of syscall. */
-struct sock_fprog __user *get_compat_bpf_fprog(char __user *optval)
-{
-       struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
-       struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog));
-       struct compat_sock_fprog f32;
-       struct sock_fprog f;
-
-       if (copy_from_user(&f32, fprog32, sizeof(*fprog32)))
-               return NULL;
-       memset(&f, 0, sizeof(f));
-       f.len = f32.len;
-       f.filter = compat_ptr(f32.filter);
-       if (copy_to_user(kfprog, &f, sizeof(struct sock_fprog)))
-               return NULL;
-
-       return kfprog;
-}
-EXPORT_SYMBOL_GPL(get_compat_bpf_fprog);
-
-static int do_set_attach_filter(struct socket *sock, int level, int optname,
-                               char __user *optval, unsigned int optlen)
-{
-       struct sock_fprog __user *kfprog;
-
-       kfprog = get_compat_bpf_fprog(optval);
-       if (!kfprog)
-               return -EFAULT;
-
-       return sock_setsockopt(sock, level, optname, (char __user *)kfprog,
-                             sizeof(struct sock_fprog));
-}
-
-static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
-                               char __user *optval, unsigned int optlen)
-{
-       if (optname == SO_ATTACH_FILTER ||
-           optname == SO_ATTACH_REUSEPORT_CBPF)
-               return do_set_attach_filter(sock, level, optname,
-                                           optval, optlen);
-       return sock_setsockopt(sock, level, optname, optval, optlen);
-}
-
-static int __compat_sys_setsockopt(int fd, int level, int optname,
-                                  char __user *optval, unsigned int optlen)
-{
-       int err;
-       struct socket *sock;
-
-       if (optlen > INT_MAX)
-               return -EINVAL;
-
-       sock = sockfd_lookup(fd, &err);
-       if (sock) {
-               err = security_socket_setsockopt(sock, level, optname);
-               if (err) {
-                       sockfd_put(sock);
-                       return err;
-               }
-
-               if (level == SOL_SOCKET)
-                       err = compat_sock_setsockopt(sock, level,
-                                       optname, optval, optlen);
-               else if (sock->ops->compat_setsockopt)
-                       err = sock->ops->compat_setsockopt(sock, level,
-                                       optname, optval, optlen);
-               else
-                       err = sock->ops->setsockopt(sock, level,
-                                       optname, optval, optlen);
-               sockfd_put(sock);
-       }
-       return err;
-}
-
-COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
-                      char __user *, optval, unsigned int, optlen)
-{
-       return __compat_sys_setsockopt(fd, level, optname, optval, optlen);
-}
-
-static int __compat_sys_getsockopt(int fd, int level, int optname,
-                                  char __user *optval,
-                                  int __user *optlen)
-{
-       int err;
-       struct socket *sock = sockfd_lookup(fd, &err);
-
-       if (sock) {
-               err = security_socket_getsockopt(sock, level, optname);
-               if (err) {
-                       sockfd_put(sock);
-                       return err;
-               }
-
-               if (level == SOL_SOCKET)
-                       err = sock_getsockopt(sock, level,
-                                       optname, optval, optlen);
-               else if (sock->ops->compat_getsockopt)
-                       err = sock->ops->compat_getsockopt(sock, level,
-                                       optname, optval, optlen);
-               else
-                       err = sock->ops->getsockopt(sock, level,
-                                       optname, optval, optlen);
-               sockfd_put(sock);
-       }
-       return err;
-}
-
-COMPAT_SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
-                      char __user *, optval, int __user *, optlen)
-{
-       return __compat_sys_getsockopt(fd, level, optname, optval, optlen);
-}
-
 /* Argument list sizes for compat_sys_socketcall */
 #define AL(x) ((x) * sizeof(u32))
 static unsigned char nas[21] = {
@@ -603,13 +489,11 @@ COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
                ret = __sys_shutdown(a0, a1);
                break;
        case SYS_SETSOCKOPT:
-               ret = __compat_sys_setsockopt(a0, a1, a[2],
-                                             compat_ptr(a[3]), a[4]);
+               ret = __sys_setsockopt(a0, a1, a[2], compat_ptr(a[3]), a[4]);
                break;
        case SYS_GETSOCKOPT:
-               ret = __compat_sys_getsockopt(a0, a1, a[2],
-                                             compat_ptr(a[3]),
-                                             compat_ptr(a[4]));
+               ret = __sys_getsockopt(a0, a1, a[2], compat_ptr(a[3]),
+                                      compat_ptr(a[4]));
                break;
        case SYS_SENDMSG:
                ret = __compat_sys_sendmsg(a0, compat_ptr(a1), a[2]);