mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
[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:
parent
f1465f7ea9
commit
f6c90b71a3
4 changed files with 86 additions and 0 deletions
|
|
@ -1892,6 +1892,29 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
|||
return rc;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static int ipx_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
/*
|
||||
* These 4 commands use same structure on 32bit and 64bit. Rest of IPX
|
||||
* commands is handled by generic ioctl code. As these commands are
|
||||
* SIOCPROTOPRIVATE..SIOCPROTOPRIVATE+3, they cannot be handled by generic
|
||||
* code.
|
||||
*/
|
||||
switch (cmd) {
|
||||
case SIOCAIPXITFCRT:
|
||||
case SIOCAIPXPRISLT:
|
||||
case SIOCIPXCFGDATA:
|
||||
case SIOCIPXNCPCONN:
|
||||
return ipx_ioctl(sock, cmd, arg);
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Socket family declarations
|
||||
*/
|
||||
|
|
@ -1913,6 +1936,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = {
|
|||
.getname = ipx_getname,
|
||||
.poll = datagram_poll,
|
||||
.ioctl = ipx_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = ipx_compat_ioctl,
|
||||
#endif
|
||||
.listen = sock_no_listen,
|
||||
.shutdown = sock_no_shutdown, /* FIXME: support shutdown */
|
||||
.setsockopt = ipx_setsockopt,
|
||||
|
|
|
|||
Loading…
Reference in a new issue