#include <net/route.h>
#include <linux/atalk.h>
-extern void aarp_cleanup_module(void);
-
-extern void aarp_probe_network(struct atalk_iface *atif);
-extern int aarp_proxy_probe_network(struct atalk_iface *atif,
- struct atalk_addr *sa);
-extern void aarp_proxy_remove(struct net_device *dev, struct atalk_addr *sa);
-
-extern void atalk_register_sysctl(void);
-extern void atalk_unregister_sysctl(void);
-
struct datalink_proto *ddp_dl, *aarp_dl;
static struct proto_ops atalk_dgram_ops;
retval = -ENOBUFS;
if (!rt)
- goto out;
+ goto out_unlock;
memset(rt, 0, sizeof(*rt));
rt->next = atalk_routes;
/* ioctl calls. Shouldn't even need touching */
/* Device configuration ioctl calls */
-static int atif_ioctl(int cmd, void *arg)
+static int atif_ioctl(int cmd, void __user *arg)
{
static char aarp_mcast[6] = { 0x09, 0x00, 0x00, 0xFF, 0xFF, 0xFF };
struct ifreq atreq;
}
/* Routing ioctl() calls */
-static int atrtr_ioctl(unsigned int cmd, void *arg)
+static int atrtr_ioctl(unsigned int cmd, void __user *arg)
{
struct rtentry rt;
case SIOCADDRT: {
struct net_device *dev = NULL;
- /*
- * FIXME: the name of the device is still in user
- * space, isn't it?
- */
if (rt.rt_dev) {
- dev = __dev_get_by_name(rt.rt_dev);
+ char name[IFNAMSIZ];
+ if (copy_from_user(name, rt.rt_dev, IFNAMSIZ-1))
+ return -EFAULT;
+ name[IFNAMSIZ-1] = '\0';
+ dev = __dev_get_by_name(name);
if (!dev)
return -ENODEV;
}
struct atalk_route *rt;
int err;
- if (flags & ~MSG_DONTWAIT)
+ if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
return -EINVAL;
if (len > DDP_MAXSZ)
{
int rc = -EINVAL;
struct sock *sk = sock->sk;
+ void __user *argp = (void __user *)arg;
switch (cmd) {
/* Protocol layer */
if (amount < 0)
amount = 0;
- rc = put_user(amount, (int *)arg);
+ rc = put_user(amount, (int __user *)argp);
break;
}
case TIOCINQ: {
if (skb)
amount = skb->len - sizeof(struct ddpehdr);
- rc = put_user(amount, (int *)arg);
+ rc = put_user(amount, (int __user *)argp);
break;
}
case SIOCGSTAMP:
- rc = sock_get_timestamp(sk, (struct timeval *)arg);
+ rc = sock_get_timestamp(sk, argp);
break;
/* Routing */
case SIOCADDRT:
case SIOCDELRT:
rc = -EPERM;
if (capable(CAP_NET_ADMIN))
- rc = atrtr_ioctl(cmd, (void *)arg);
+ rc = atrtr_ioctl(cmd, argp);
break;
/* Interface */
case SIOCGIFADDR:
case SIOCSARP: /* proxy AARP */
case SIOCDARP: /* proxy AARP */
rtnl_lock();
- rc = atif_ioctl(cmd, (void *)arg);
+ rc = atif_ioctl(cmd, argp);
rtnl_unlock();
break;
/* Physical layer ioctl calls */
case SIOCGIFCOUNT:
case SIOCGIFINDEX:
case SIOCGIFNAME:
- rc = dev_ioctl(cmd, (void *)arg);
+ rc = dev_ioctl(cmd, argp);
break;
}