cfg80211: fix crash in cfg80211_set_freq()
[safe/jmp/linux-2.6] / net / econet / af_econet.c
index e114da7..2a5a805 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/wireless.h>
 #include <linux/skbuff.h>
 #include <linux/udp.h>
+#include <linux/slab.h>
 #include <net/sock.h>
 #include <net/inet_common.h>
 #include <linux/stat.h>
@@ -457,15 +458,15 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
        iov[0].iov_len = size;
        for (i = 0; i < msg->msg_iovlen; i++) {
                void __user *base = msg->msg_iov[i].iov_base;
-               size_t len = msg->msg_iov[i].iov_len;
+               size_t iov_len = msg->msg_iov[i].iov_len;
                /* Check it now since we switch to KERNEL_DS later. */
-               if (!access_ok(VERIFY_READ, base, len)) {
+               if (!access_ok(VERIFY_READ, base, iov_len)) {
                        mutex_unlock(&econet_mutex);
                        return -EFAULT;
                }
                iov[i+1].iov_base = base;
-               iov[i+1].iov_len = len;
-               size += len;
+               iov[i+1].iov_len = iov_len;
+               size += iov_len;
        }
 
        /* Get a skbuff (no data, just holds our cb information) */
@@ -520,6 +521,7 @@ static int econet_getname(struct socket *sock, struct sockaddr *uaddr,
        if (peer)
                return -EOPNOTSUPP;
 
+       memset(sec, 0, sizeof(*sec));
        mutex_lock(&econet_mutex);
 
        sk = sock->sk;
@@ -604,13 +606,14 @@ static struct proto econet_proto = {
  *     Create an Econet socket
  */
 
-static int econet_create(struct net *net, struct socket *sock, int protocol)
+static int econet_create(struct net *net, struct socket *sock, int protocol,
+                        int kern)
 {
        struct sock *sk;
        struct econet_sock *eo;
        int err;
 
-       if (net != &init_net)
+       if (!net_eq(net, &init_net))
                return -EAFNOSUPPORT;
 
        /* Econet only provides datagram services. */
@@ -741,7 +744,7 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg
        return 0;
 }
 
-static struct net_proto_family econet_family_ops = {
+static const struct net_proto_family econet_family_ops = {
        .family =       PF_ECONET,
        .create =       econet_create,
        .owner  =       THIS_MODULE,