diff options
author | Petr Vandrovec <petr@vandrovec.name> | 2006-03-28 02:39:31 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-28 20:02:43 -0500 |
commit | f6c90b71a355a0a4a22e1cfee5748617adc25a53 (patch) | |
tree | 2fdbe51a57e25a781128ce4a8c85375201221ded /net/ipx/af_ipx.c | |
parent | f1465f7ea9e7aecba8e41d4aac9240f9b7fe2e24 (diff) |
[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 <petr@vandrovec.name>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipx/af_ipx.c')
-rw-r--r-- | net/ipx/af_ipx.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 0fb513a34d11..2dbf134d5266 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1892,6 +1892,29 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1892 | return rc; | 1892 | return rc; |
1893 | } | 1893 | } |
1894 | 1894 | ||
1895 | |||
1896 | #ifdef CONFIG_COMPAT | ||
1897 | static int ipx_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
1898 | { | ||
1899 | /* | ||
1900 | * These 4 commands use same structure on 32bit and 64bit. Rest of IPX | ||
1901 | * commands is handled by generic ioctl code. As these commands are | ||
1902 | * SIOCPROTOPRIVATE..SIOCPROTOPRIVATE+3, they cannot be handled by generic | ||
1903 | * code. | ||
1904 | */ | ||
1905 | switch (cmd) { | ||
1906 | case SIOCAIPXITFCRT: | ||
1907 | case SIOCAIPXPRISLT: | ||
1908 | case SIOCIPXCFGDATA: | ||
1909 | case SIOCIPXNCPCONN: | ||
1910 | return ipx_ioctl(sock, cmd, arg); | ||
1911 | default: | ||
1912 | return -ENOIOCTLCMD; | ||
1913 | } | ||
1914 | } | ||
1915 | #endif | ||
1916 | |||
1917 | |||
1895 | /* | 1918 | /* |
1896 | * Socket family declarations | 1919 | * Socket family declarations |
1897 | */ | 1920 | */ |
@@ -1913,6 +1936,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = { | |||
1913 | .getname = ipx_getname, | 1936 | .getname = ipx_getname, |
1914 | .poll = datagram_poll, | 1937 | .poll = datagram_poll, |
1915 | .ioctl = ipx_ioctl, | 1938 | .ioctl = ipx_ioctl, |
1939 | #ifdef CONFIG_COMPAT | ||
1940 | .compat_ioctl = ipx_compat_ioctl, | ||
1941 | #endif | ||
1916 | .listen = sock_no_listen, | 1942 | .listen = sock_no_listen, |
1917 | .shutdown = sock_no_shutdown, /* FIXME: support shutdown */ | 1943 | .shutdown = sock_no_shutdown, /* FIXME: support shutdown */ |
1918 | .setsockopt = ipx_setsockopt, | 1944 | .setsockopt = ipx_setsockopt, |