]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/core/sock.c
[PATCH] softmac: update deauth handler to quiet warning
[linux-2.6-omap-h63xx.git] / net / core / sock.c
index 1c52fe809edad0a79038748f589c915ec96f6a6f..1a7e6eac90b04f89efca8620ed64686496a8e647 100644 (file)
@@ -91,6 +91,7 @@
  *             2 of the License, or (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
@@ -615,7 +616,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
                        break;
 
                case SO_PEERSEC:
-                       return security_socket_getpeersec(sock, optval, optlen, len);
+                       return security_socket_getpeersec_stream(sock, optval, optlen, len);
 
                default:
                        return(-ENOPROTOOPT);
@@ -940,7 +941,7 @@ static struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
                                            int noblock, int *errcode)
 {
        struct sk_buff *skb;
-       unsigned int gfp_mask;
+       gfp_t gfp_mask;
        long timeo;
        int err;
 
@@ -1242,8 +1243,7 @@ static void sock_def_write_space(struct sock *sk)
 
 static void sock_def_destruct(struct sock *sk)
 {
-       if (sk->sk_protinfo)
-               kfree(sk->sk_protinfo);
+       kfree(sk->sk_protinfo);
 }
 
 void sk_send_sigurg(struct sock *sk)
@@ -1385,6 +1385,20 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname,
 
 EXPORT_SYMBOL(sock_common_getsockopt);
 
+#ifdef CONFIG_COMPAT
+int compat_sock_common_getsockopt(struct socket *sock, int level, int optname,
+                                 char __user *optval, int __user *optlen)
+{
+       struct sock *sk = sock->sk;
+
+       if (sk->sk_prot->compat_setsockopt != NULL)
+               return sk->sk_prot->compat_getsockopt(sk, level, optname,
+                                                     optval, optlen);
+       return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
+}
+EXPORT_SYMBOL(compat_sock_common_getsockopt);
+#endif
+
 int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
                        struct msghdr *msg, size_t size, int flags)
 {
@@ -1414,6 +1428,20 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname,
 
 EXPORT_SYMBOL(sock_common_setsockopt);
 
+#ifdef CONFIG_COMPAT
+int compat_sock_common_setsockopt(struct socket *sock, int level, int optname,
+                                 char __user *optval, int optlen)
+{
+       struct sock *sk = sock->sk;
+
+       if (sk->sk_prot->compat_setsockopt != NULL)
+               return sk->sk_prot->compat_setsockopt(sk, level, optname,
+                                                     optval, optlen);
+       return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen);
+}
+EXPORT_SYMBOL(compat_sock_common_setsockopt);
+#endif
+
 void sk_common_release(struct sock *sk)
 {
        if (sk->sk_prot->destroy)
@@ -1489,7 +1517,7 @@ int proto_register(struct proto *prot, int alloc_slab)
                        }
                }
 
-               if (prot->twsk_obj_size) {
+               if (prot->twsk_prot != NULL) {
                        static const char mask[] = "tw_sock_%s";
 
                        timewait_sock_slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL);
@@ -1498,11 +1526,12 @@ int proto_register(struct proto *prot, int alloc_slab)
                                goto out_free_request_sock_slab;
 
                        sprintf(timewait_sock_slab_name, mask, prot->name);
-                       prot->twsk_slab = kmem_cache_create(timewait_sock_slab_name,
-                                                           prot->twsk_obj_size,
-                                                           0, SLAB_HWCACHE_ALIGN,
-                                                           NULL, NULL);
-                       if (prot->twsk_slab == NULL)
+                       prot->twsk_prot->twsk_slab =
+                               kmem_cache_create(timewait_sock_slab_name,
+                                                 prot->twsk_prot->twsk_obj_size,
+                                                 0, SLAB_HWCACHE_ALIGN,
+                                                 NULL, NULL);
+                       if (prot->twsk_prot->twsk_slab == NULL)
                                goto out_free_timewait_sock_slab_name;
                }
        }
@@ -1549,12 +1578,12 @@ void proto_unregister(struct proto *prot)
                prot->rsk_prot->slab = NULL;
        }
 
-       if (prot->twsk_slab != NULL) {
-               const char *name = kmem_cache_name(prot->twsk_slab);
+       if (prot->twsk_prot != NULL && prot->twsk_prot->twsk_slab != NULL) {
+               const char *name = kmem_cache_name(prot->twsk_prot->twsk_slab);
 
-               kmem_cache_destroy(prot->twsk_slab);
+               kmem_cache_destroy(prot->twsk_prot->twsk_slab);
                kfree(name);
-               prot->twsk_slab = NULL;
+               prot->twsk_prot->twsk_slab = NULL;
        }
 }