Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3536371yba; Tue, 16 Apr 2019 13:30:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqySWau69gjc5Dk3XCCeBmoj10CbK24dP9vG8BAT/cTfb1p6vt+YLNIly4Y77VihNiIHEW7f X-Received: by 2002:a62:524e:: with SMTP id g75mr83257132pfb.106.1555446608086; Tue, 16 Apr 2019 13:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555446608; cv=none; d=google.com; s=arc-20160816; b=FVxS8Ld9yZo7ZfgiSTUZYEdGDbUVd9PrF7Lv3Rw6yXbVvG4UAhuVOFBTKPvdShZdcC 7dz6r22cb6KMAnuwTBa5Ij1+AMFZB6y4Vl8c9MrLYKcwgYcaFwx+fYLfFSiGD/RDNhtu hGygNbHN5GTGY4Md3AqorNP7WlAbN63YBGbhNxRqhdYHF725OtCnQu9bF4s96KE7vhlA yLvuqAAv3ZkaikplYvCqA2z9X9OiE/QPxRvNTZZ/cR5O3RdoSYFC6IgmT5NS7LfZUROA f+zoEtN4LrJ16nuZ2qL/rtzEptC0/cdVKpBQbvO9zEZdoBZEIauJFg0IhyMkPB9Tbf3n TUSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=JR8OpN2ndqmbHlheoOPdXsn99VOAIzNJ5x4QnNXip1o=; b=v9n8Ob8C8D2Gc/mnvJknNXija7K23ongustHsrftGt772JlejTKu8z44TnzTw6Q/RD of/poCjrIFomnT9rwVLgQRs/vYzcIdv2oiiis9NRRPU5QJlWM8xOz1p/Ylyp9cETyvrL Z7hAG5UZ5lyQn1EdN1+sK4knmMp21muRfJM2lhy0UmKu5wfWQYr1jQjFATv+CaTyzpjw 1D2YLaVcOro+3Tn8bY/TZV3Ktlfc7Gqi4afuUAx+fmSs0u5JN0ymvd3uLeKaISDdXja0 0geLPZTW009G20StYqwcSuEjS/UK9NPQp07GO3Zq3VqfXj8RGsTQO4RJnfrmGm+HmYsK 229g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11si35087068pgw.384.2019.04.16.13.29.51; Tue, 16 Apr 2019 13:30:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730756AbfDPU2q (ORCPT + 99 others); Tue, 16 Apr 2019 16:28:46 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:55579 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730442AbfDPU2C (ORCPT ); Tue, 16 Apr 2019 16:28:02 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1MlNgx-1gZyGk3BEr-00llxR; Tue, 16 Apr 2019 22:27:55 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Marcel Holtmann , Johan Hedberg , "David S. Miller" , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 17/26] compat_ioctl: move hci_sock handlers into driver Date: Tue, 16 Apr 2019 22:25:38 +0200 Message-Id: <20190416202701.127745-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190416202701.127745-1-arnd@arndb.de> References: <20190416202013.4034148-1-arnd@arndb.de> <20190416202701.127745-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:wVrrxHykN4m2wuv4wYPBq2QrDsrHr9makxgNyqWbgjd+bJpateF 2WUZMhf20F9hdOvX/sNasRpmVnG2PfnLG6yidhtLbo8vRU1lerMkZq96jvaIfsjcqSjb+1P bQN6Y8Fr6S8vIJxT2FRCR8xfnPokm5YOLAa598BvzLR6ojgJ3wAj08WCRO6QO8kA5Wy/cq8 e9T5GQWp3jJ6mKXF+MRMw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:KwnzaPtod3Q=:/jbjy/rdACzfKB/hEu3lc7 g5wAhER3Di/By6pnDEPrwGhMjilM3HgmBA6Xn8rzEr5A3xRVRRa70f0UtyYo4h68Z/7Dirj6H 2VLGR29iJLoM9yeubBbcwkx5pLP+rg84ZoFRJNtwOg4tZVUZyI3rTQkEzsRZVhICJ1COi0Cp/ eCFM+//PMCuAm7e7JhhO5u/VLM1mGu+cuH3V27dsoIcvPfwTa/LT8rxcfB7W8I0W7Ni7VWQY5 xcVIpqb3PopkvORvH8FCKJNR9IjpZqnGe2X8qbxGjtLRNpIZ/Lc6eKXjM06jWtfzplup4N8kP iP2KpvAfcTaiDOZ1Hl/sI/qqpEBASc1Gz2KFWlPruUswAW63gqdhJqeXfMXcEJxKnytIaEgLe ftzIVNT73mUNJt35tX8AWuZSUxbWGOiRJLtWXMaEbrcZg3s00tI0x4N/FcAFhZ8qzULO6jvdW vLeMzU4eLWeUOVJRNlC3hxnXRmzi4nqhdaTxKcqGsJ6btAc0fkXwW/Buspj5QnRipWpxf6DKm HUIQjI6cWGzoce1PNSvJGTtyf6VFM2owCN3ROxBExHCoUBpeU/wzW5Q/cEIVkwkNKv+UUxwQk scNmZOxp8u8LLCV17r5LBZQxssa/tLaxKj8z3ZxtHnHKlPcjj6khrvA5dWmhyaxMBzCArzeLC sxu+NbMZ8s/UNjQd8vC96mUmHz15/g4J81oYTdzQ8c51M7jAaASWZ4lSGgVrAwwJwJbHkm9lj 8IJYoQ1CpcDjrKvopUbxuSlc//BVPkmiZ6du3g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All these ioctl commands are compatible, so we can handle them with a trivial wrapper in hci_sock.c and remove the listing in fs/compat_ioctl.c. A few of the commands pass integer arguments instead of pointers, so for correctness skip the compat_ptr() conversion here. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 24 ------------------------ net/bluetooth/hci_sock.c | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index efe3df389150..9024cae05eda 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -40,9 +40,6 @@ #include "internal.h" -#include -#include - #ifdef CONFIG_BLOCK #include #include @@ -587,27 +584,6 @@ COMPATIBLE_IOCTL(RNDADDENTROPY) COMPATIBLE_IOCTL(RNDZAPENTCNT) COMPATIBLE_IOCTL(RNDCLEARPOOL) /* Bluetooth */ -COMPATIBLE_IOCTL(HCIDEVUP) -COMPATIBLE_IOCTL(HCIDEVDOWN) -COMPATIBLE_IOCTL(HCIDEVRESET) -COMPATIBLE_IOCTL(HCIDEVRESTAT) -COMPATIBLE_IOCTL(HCIGETDEVLIST) -COMPATIBLE_IOCTL(HCIGETDEVINFO) -COMPATIBLE_IOCTL(HCIGETCONNLIST) -COMPATIBLE_IOCTL(HCIGETCONNINFO) -COMPATIBLE_IOCTL(HCIGETAUTHINFO) -COMPATIBLE_IOCTL(HCISETRAW) -COMPATIBLE_IOCTL(HCISETSCAN) -COMPATIBLE_IOCTL(HCISETAUTH) -COMPATIBLE_IOCTL(HCISETENCRYPT) -COMPATIBLE_IOCTL(HCISETPTYPE) -COMPATIBLE_IOCTL(HCISETLINKPOL) -COMPATIBLE_IOCTL(HCISETLINKMODE) -COMPATIBLE_IOCTL(HCISETACLMTU) -COMPATIBLE_IOCTL(HCISETSCOMTU) -COMPATIBLE_IOCTL(HCIBLOCKADDR) -COMPATIBLE_IOCTL(HCIUNBLOCKADDR) -COMPATIBLE_IOCTL(HCIINQUIRY) COMPATIBLE_IOCTL(HCIUARTSETPROTO) COMPATIBLE_IOCTL(HCIUARTGETPROTO) COMPATIBLE_IOCTL(HCIUARTGETDEVICE) diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index d32077b28433..5d0ed28c0d3a 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -23,7 +23,7 @@ */ /* Bluetooth HCI sockets. */ - +#include #include #include #include @@ -1054,6 +1054,22 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, 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, -- 2.20.0