Merge tag 'compat-ioctl-5.5' of git://git.kernel.org:/pub/scm/linux/kernel/git/arnd...
[sfrench/cifs-2.6.git] / net / bluetooth / hci_sock.c
index d32077b284337ff4086701b0fa5817a173e09d03..5d0ed28c0d3afaa5a8301ab4e0cfa64e14e0daee 100644 (file)
@@ -23,7 +23,7 @@
 */
 
 /* Bluetooth HCI sockets. */
-
+#include <linux/compat.h>
 #include <linux/export.h>
 #include <linux/utsname.h>
 #include <linux/sched.h>
@@ -1054,6 +1054,22 @@ done:
        return err;
 }
 
+#ifdef CONFIG_COMPAT
+static int hci_sock_compat_ioctl(struct socket *sock, unsigned int cmd,
+                                unsigned long arg)
+{
+       switch (cmd) {
+       case HCIDEVUP:
+       case HCIDEVDOWN:
+       case HCIDEVRESET:
+       case HCIDEVRESTAT:
+               return hci_sock_ioctl(sock, cmd, arg);
+       }
+
+       return hci_sock_ioctl(sock, cmd, (unsigned long)compat_ptr(arg));
+}
+#endif
+
 static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
                         int addr_len)
 {
@@ -1974,6 +1990,9 @@ static const struct proto_ops hci_sock_ops = {
        .sendmsg        = hci_sock_sendmsg,
        .recvmsg        = hci_sock_recvmsg,
        .ioctl          = hci_sock_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl   = hci_sock_compat_ioctl,
+#endif
        .poll           = datagram_poll,
        .listen         = sock_no_listen,
        .shutdown       = sock_no_shutdown,