[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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Petr Vandrovec 2006-03-27 23:39:31 -08:00 • committed by David S. Miller
commit f6c90b71a3
4 changed files with 86 additions and 0 deletions

View file

@ -1819,6 +1819,22 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
return rc;
}
#ifdef CONFIG_COMPAT
static int atalk_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
/*
* All Appletalk ioctls except SIOCATALKDIFADDR are standard. And
* SIOCATALKDIFADDR is handled by upper layer as well, so there is
* nothing to do. Eventually SIOCATALKDIFADDR should be moved
* here so there is no generic SIOCPROTOPRIVATE translation in the
* system.
*/
return -ENOIOCTLCMD;
}
#endif
static struct net_proto_family atalk_family_ops = {
.family = PF_APPLETALK,
.create = atalk_create,
@ -1836,6 +1852,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(atalk_dgram_ops) = {
.getname = atalk_getname,
.poll = datagram_poll,
.ioctl = atalk_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = atalk_compat_ioctl,
#endif
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
.setsockopt = sock_no_setsockopt,