mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
af_unix: add compat_ioctl support
commit 5f6beb9e0f633f3cc845cdd67973c506372931b4 upstream.
The af_unix protocol family has a custom ioctl command (inexplicibly
based on SIOCPROTOPRIVATE), but never had a compat_ioctl handler for
32-bit applications.
Since all commands are compatible here, add a trivial wrapper that
performs the compat_ptr() conversion for SIOCOUTQ/SIOCINQ. SIOCUNIXFILE
does not use the argument, but it doesn't hurt to also use compat_ptr()
here.
Fixes: ba94f3088b ("unix: add ioctl to open a unix socket file with O_PATH")
Cc: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
de1605c603
commit
60cc5607bd
1 changed files with 19 additions and 0 deletions
|
|
@ -646,6 +646,9 @@ static __poll_t unix_poll(struct file *, struct socket *, poll_table *);
|
|||
static __poll_t unix_dgram_poll(struct file *, struct socket *,
|
||||
poll_table *);
|
||||
static int unix_ioctl(struct socket *, unsigned int, unsigned long);
|
||||
#ifdef CONFIG_COMPAT
|
||||
static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
|
||||
#endif
|
||||
static int unix_shutdown(struct socket *, int);
|
||||
static int unix_stream_sendmsg(struct socket *, struct msghdr *, size_t);
|
||||
static int unix_stream_recvmsg(struct socket *, struct msghdr *, size_t, int);
|
||||
|
|
@ -687,6 +690,9 @@ static const struct proto_ops unix_stream_ops = {
|
|||
.getname = unix_getname,
|
||||
.poll = unix_poll,
|
||||
.ioctl = unix_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = unix_compat_ioctl,
|
||||
#endif
|
||||
.listen = unix_listen,
|
||||
.shutdown = unix_shutdown,
|
||||
.setsockopt = sock_no_setsockopt,
|
||||
|
|
@ -710,6 +716,9 @@ static const struct proto_ops unix_dgram_ops = {
|
|||
.getname = unix_getname,
|
||||
.poll = unix_dgram_poll,
|
||||
.ioctl = unix_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = unix_compat_ioctl,
|
||||
#endif
|
||||
.listen = sock_no_listen,
|
||||
.shutdown = unix_shutdown,
|
||||
.setsockopt = sock_no_setsockopt,
|
||||
|
|
@ -732,6 +741,9 @@ static const struct proto_ops unix_seqpacket_ops = {
|
|||
.getname = unix_getname,
|
||||
.poll = unix_dgram_poll,
|
||||
.ioctl = unix_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = unix_compat_ioctl,
|
||||
#endif
|
||||
.listen = unix_listen,
|
||||
.shutdown = unix_shutdown,
|
||||
.setsockopt = sock_no_setsockopt,
|
||||
|
|
@ -2582,6 +2594,13 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
|||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
return unix_ioctl(sock, cmd, (unsigned long)compat_ptr(arg));
|
||||
}
|
||||
#endif
|
||||
|
||||
static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
|
|
|
|||
Loading…
Reference in a new issue