From f6c90b71a355a0a4a22e1cfee5748617adc25a53 Mon Sep 17 00:00:00 2001 From: Petr Vandrovec Date: Mon, 27 Mar 2006 23:39:31 -0800 Subject: [NET]: Fix ipx/econet/appletalk/irda ioctl crashes Fix kernel oopses whenever somebody issues compatible ioctl on AppleTalk, Econet, IPX or IRDA socket. For AppleTalk/Econet/IRDA it restores state in which these sockets were before compat_ioctl was introduced to the socket ops, for IPX it implements support for 4 ioctls which were not implemented before - as these ioctls use structures which match between 32bit and 64bit userspace, no special code is needed, just call 64bit ioctl handler. Signed-off-by: Petr Vandrovec Signed-off-by: David S. Miller --- net/econet/af_econet.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'net/econet') diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index c792994..0c4c83b 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c @@ -693,6 +693,19 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg return 0; } +#ifdef CONFIG_COMPAT +static int econet_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) +{ + /* + * All ioctls provided by econet are standard. There is one gotcha, sockaddr_ec + * differs between 32bit and 64bit. Fortunately nobody in kernel uses portion + * of sockaddr which differs between 32bit and 64bit, so we do not need special + * handling. + */ + return -ENOIOCTLCMD; +} +#endif + static struct net_proto_family econet_family_ops = { .family = PF_ECONET, .create = econet_create, @@ -710,6 +723,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(econet_ops) = { .getname = econet_getname, .poll = datagram_poll, .ioctl = econet_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = econet_compat_ioctl, +#endif .listen = sock_no_listen, .shutdown = sock_no_shutdown, .setsockopt = sock_no_setsockopt, -- cgit v1.1