From patchwork Wed Oct 9 19:10:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175634 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1170360ill; Wed, 9 Oct 2019 12:11:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4TREy+cs9zasGDbpuoyMrTQS+sRwl1MsxGgHZ22mhaJVPIFYfo9r8EpPp9oVYP9L/f4+x X-Received: by 2002:a17:906:298f:: with SMTP id x15mr4308599eje.50.1570648268378; Wed, 09 Oct 2019 12:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648268; cv=none; d=google.com; s=arc-20160816; b=THRBIKnQ23ctftle5okcWj/su/vhshyaMrNFzpOYgYWc1bXzzuBjePomnJ4muIvfID a7Jdi8iuuUYOXI0nT0umDRS0YMF9wXyFLWR22R+tKx3uX/vRNR9pAlwm9tCZTPPkv/2c 41J2E7TNLHHcMNRYKl8qbZ6U8VSAU7pzkLh6/j4bvkFPj7ZWB+H+xiTgmcxEYKxR/P9q oMPticgi7uuXxEYlRm8zko3Rqdq8+fPzxCr+wZ01fP5DnOgvgK3ZDCKGw5gYTcfHkjvb fFCAgRSZ2oUiswK7hvTrIW7qVivSSHPlk8yyNoItbKuXfO/XODDZQMn8k6OYTuHchiWa 0kBA== 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=qBe0RxGqYa2Mz1EAUqLg0S4YUw9XHpWnxmmzZ7QKh6w=; b=zV0WnzBcBAGy/M5rAP/xeXmIx9HNnDYjhItHEcaGGFnX9rb+rIRTr+nE41JQfdunue TdEk3W5wRFpgZFa/w6t/AEHY7lhI8gON0GMoaL+pB8SwG1AMQURT5VxMwxeDMy/HL/GD eWQfdO51Owx9Wtr3IiyDFqEthrYg1D6TpQfdCVrXnvkiabzX3WLpfFNAwPozsenAjcLl 2SljCWteKyOtFvHM3Azi6jXoit9TF1rJrs3y/XloaB8H2UNTqyBqXmRKOZBEWYg7rRbW GXExr9xQDmkOLOPGKkIm41EPsfFr9p7kh8HB6l5GXRma0foSWEzzX/9JUL0nSNJLAfjc jQlA== 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 q13si1711323eju.46.2019.10.09.12.11.08; Wed, 09 Oct 2019 12:11: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 S1731625AbfJITLH (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:07 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:36045 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728804AbfJITLG (ORCPT ); Wed, 9 Oct 2019 15:11:06 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MCKWI-1iQUqA1iMc-009Tzp; Wed, 09 Oct 2019 21:11:04 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 01/43] fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP Date: Wed, 9 Oct 2019 21:10:01 +0200 Message-Id: <20191009191044.308087-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:2uJzilWeK+WiT0h/pPdN3K/mVdDW9vuZKh5Yov5RjBQWLhEkFap up2GIxj8olvwQyD7nR6AsIG1/ngU6zLv+NT0Y0oU00nKWO6ezKQaqr/JnGgm1oSKtbbC3SO uYzStCkbpGXYKZlSiTsjT053BoaE5r0D1mmmRBMk5nKa4JV3IMvPXaF55mk6LpR5WrXNxYf T2KievGd+GbjOXz6xVSfw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:NRFYuPKnEzE=:+jRPMK5onbQzyVK1NHGVFD OTAzT1XPimm0LNZEtTF71Ls8QCgcHoLMeVDlIFljoRwUflgKvHTB7BMUZHgfa4LV/HXvZR6Wi lpCvt26D0MrhZdB7iLnpQyhz/sbkkaDzNPuewSvyG3fk4RyMm3eNlOFGADFygQ7oFf8HlBJrb TSG+GrUflecniKNUu3nUj0LQ87hRmJ9r8mAKzf2uya08bvMmeXXbRHWRcHwM5murzvUhmvW9D UaAY/nQzTBBYXR17b/hHClU2+65r0MqBxGaM9BzqXX6WI65zZ6C7h/jns+vBBkKJg8yVITWGN AlifMCCwgeHZ+7aklSauD6cRN0b55xqXMHAlISjdbfpRMza3GreD/s6r0JbCbuFAaFhpoQuBw p58j7/ZRPbqwlgMA/xQw7h4G3dsJdjyB8dTrcy/570F+X43+YHbOTGzI/sML8wd0+gk+cNnGo PIGHlQvHlGmAQQ3fRr7utBE9d5mo5rMN6gv+zrAIdWThhXelSn8bfUFDWXHb3nxhN27ulG0dL rki5fZl7jLs16uIOe4izdDqhR9a7ZqCe0tvVMZzqaq5O64ksLusQWThq2EJL4qIRjm7QeE29n vNw/Kw+6mVZ4PU1uJEVkCnuBLy6JNWV+j+QtaYfx9PSwBMa6oeJFHfaD/ujFHX62XGFRRHWr0 MUkskSrK4tIckxJIDq+blZCBvl1aqEumKcQ9Y6sS0lIRiA4yeA9tQn0Z3wiWOEq7SwPsMMPh8 mf920VjPDEVFVfhEAdhAt61uDO9UgQUyIau3EoTCEWuIQPnaO2gUEXX62dN42Ru1t+GSRDNSo 0vUguuUma6IZR2u4o5ElRna9moSK2Qqi9+IJJ1U67PTE+GhYB7qI1P9SnApsa4ezL2S/FIS1Y CromSpYbYmQDcqkn512Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Unlike FICLONE, all of those take a pointer argument; they do need compat_ptr() applied to arg. Fixes: d79bdd52d8be ("vfs: wire up compat ioctl for CLONE/CLONE_RANGE") Fixes: 54dbc1517237 ("vfs: hoist the btrfs deduplication ioctl to the vfs") Fixes: ceac204e1da9 ("fs: make fiemap work from compat_ioctl") Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index a7ec2d3dff92..e0226b2138d6 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1032,10 +1032,11 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, #endif case FICLONE: + goto do_ioctl; case FICLONERANGE: case FIDEDUPERANGE: case FS_IOC_FIEMAP: - goto do_ioctl; + goto found_handler; case FIBMAP: case FIGETBSZ: From patchwork Wed Oct 9 19:10:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175635 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1170496ill; Wed, 9 Oct 2019 12:11:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwT3bpTpxha8cQXoS+wfx621bLpIkCcV/P/yHvgebatVPY0VCxvNfe8cXN9gn2FyopIvJBx X-Received: by 2002:a05:6402:170e:: with SMTP id y14mr4541334edu.82.1570648274286; Wed, 09 Oct 2019 12:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648274; cv=none; d=google.com; s=arc-20160816; b=gPWzkm5cP0mHUkY7xFpBp9ODUbwHAbzHYKJVUJ7sK6pBsM+ZptjgL64OAtWFe2KHji 2HBuXJfpLW2ep2kW7EFD1KTDpreIpazRdHOzfUNf7VWPY1ttUpIz1pu2W82zWX4Z1SB6 tcwGmLofkujh1nw+7XdSsf+gZ18mjF/YgIfDmMyiEGbbaWUgQekcUGn5oNzcf8ulSP27 WLvJvtgCb0FZZ5TXMyARSvkJtAf0YlrFBI3OKM4BJZmFYF6kH/OgzPz3i9zZHd4U4SbZ QpaUST+im8IMLSnpWmoZttqARGOA5k99FtQRgrkDPhOMD4UzbnHF364kExHpwbeoex5U WD4Q== 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=BLLuVrfId9acgR0yGMbPjM6czG5CMnM87YwaQnPUMWw=; b=NEotKVYzel3inLmCNRylpNOzRS2MymKdaGF1EPTpnYStJDB82f+/adIMCeG1bMLh8U K9VbbynzEkEBlg6OMgepqAMpNUgc2rsfSX8ZPsRuuPiqZn7/6AhBIkZI5lm8ycp0aARj MBSvV568NRpNi0IWICVC+uwB+4xO+q81o19vDQhDCN9zUEbx3rwJEfUD3gpbCxHzHpx9 Y20JZYNdy/cm1pO/OsiRQhXH5XkDjPCKChnk7TI2EBk4rNF6UDIdyPSxcUHTFQMELgX+ 1+lg/BkpC7QnoH7aFmgh7ADgRegTtnmzSOmeHiHiQkuDVBnFxbMhx8lQbijUK7WZngiF XPNg== 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 g30si1996732eda.2.2019.10.09.12.11.14; Wed, 09 Oct 2019 12:11:14 -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 S1731722AbfJITLI (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:08 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:55707 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731155AbfJITLH (ORCPT ); Wed, 9 Oct 2019 15:11:07 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M4K2r-1iIYTh2itF-000NJG; Wed, 09 Oct 2019 21:11:04 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 02/43] FIGETBSZ: fix compat Date: Wed, 9 Oct 2019 21:10:02 +0200 Message-Id: <20191009191044.308087-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:xOPUUgwb9odFpHq6jGq9oq7v32LjQ90BrUA6zWbYbOD03AWqQJR rl8MvyzLu43RhF+zfWpAouPgWEloxlsGy99hCAszmYskH+sMhQrx3QtR+M33G0MMl/bXkDX V6za0ZZG5lHTKQQoOkYn2caznumYN/cCXlG/AA8MlY5dfCyFMtM0UZoDqCnrNhn1cy2rgFH fg8hZ/r6OR7oHL0PRhClg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:7//ZRsP+fYE=:uY2u92yNBevu7F/X2nNVWk HgMtI6F3GByFsCBoej+0oUWOABnYqLsYPpwRTfIek+2WQ3MN+KUiPmOicwR+YS0Lx+3jpRa7D No0mCTOwFH0mbw73vzx7+KTXFPy0XTD6r8nHdRwRti5iKhlngaRblQn3bq+NAUOT5nSsAZclb tjNZp0WUPs6HslmvrXqpU7E8m8a8xgux2OpuLYhvltHWlw7yKDQlO8slNdDwhLwOmXGtnwaHy KyjrpXhntNaCkbTued3EgSdZhj27ujnbljNAknzLZhFeWwDk8UdEJNL6fWDK0L/XCDIn0Xy+G 1BNOu3Ipx/I1a5Hk2RKXb0Z8u21fjEHh/1VplV8BrYcY2Ky1XzsctT4RMRYGfNajO+nTl1f1G tceLvrDZCk2VMIXs3IsyYKnJQykxrvHbQ5OQ37HM6aX2VZ73gI94fAgfX8XQwz+7m1/U+/wxR grGAl6I/Kg30KXIz98hqN18SJppOJdBKPHBYxBSHCJj5zAncZlHI8BUj+60YTFd6nnaTpdwMO lBD9BGalGkUp73qu5CZ5Jpitz1aTGqAaQoFmT9rzHwqoPWLw3Tkrym9h+JhIVwRnn83biTNX2 1OKPdg8m1J/JM7Wt5rxEj6zBFnwPo/ug/RuGgunE4gPd4hlBqpA794uVt7hq2TKBmdq6Ohpx+ 6Me5MW57a4BXb1+pXtwK6Mv6NqO22+gYBIOH4V6JLaHWDVaGE9CFx6fZbZY5HV7bB36rr+cC2 nPw/jiHyHmGIRf9arRZ77cWUPiJfSB1CGPnUUvGcb8/4i//Lzg0rPLr6C88W1LLxp+xulOyIC EjGPxmgKLmNTTC0ju9icyAc04pGJ5Cg5uUfAxb3wJ970h8vXuCSQo6Y+AEna5ulbIRUYeb7ZB GuDNgbPM9ctel9zpDW+Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro it takes a pointer argument, regular file or no regular file Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index e0226b2138d6..a979b7d1ed90 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1036,10 +1036,10 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, case FICLONERANGE: case FIDEDUPERANGE: case FS_IOC_FIEMAP: + case FIGETBSZ: goto found_handler; case FIBMAP: - case FIGETBSZ: case FIONREAD: if (S_ISREG(file_inode(f.file)->i_mode)) break; From patchwork Wed Oct 9 19:10:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175674 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1175032ill; Wed, 9 Oct 2019 12:15:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaETXlh/ulZjqQykt9xsUi9o8+WuZdR/mYBwN+ZAyBdX3ptwnPJHBwwx20k9jlbS9VB2Rj X-Received: by 2002:aa7:c6cf:: with SMTP id b15mr4412112eds.215.1570648506934; Wed, 09 Oct 2019 12:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648506; cv=none; d=google.com; s=arc-20160816; b=efsw7w3pkhHFaco/FHROLYecRkd5w+HZoMQ6G1YIn3sHblvIvTLB3sebZzvdEUPlZL jtBUQBF4md/MLwfXeDmKHRlSOunLr/PkI6LxydG0GHGpk66SdLGUc4WrSI0x5KEs+6we 7MBzXrqrdaYruE95B5y2vba/SO0KpzfMCQE6tmGU9XinQ+wivp7o1TwK4bvQSQ2NBSqa 6a8B3gQZOfvWQGpCgqH8NZKReh3mLZsMLUecJATLBOMK5Aj03dOMjwiEu2UVmqY5nlWq zeFpPnwaTqvtBWuMFln8hlzs/v9Pd26hMyuk5Y1UI0wnDWvx0AfMPAJvIS48lQG+sgEP GIPQ== 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=l92MTe2rUGUuesgn33KTO6Z7KypLpKhFtvuLTzY+9OE=; b=ahbF9YdMj8L7PM4ZR1ZfDhFgSLRET3C+veuNKO4TBZN4fj4Mkf00Ms2pim2kC84TP2 pYJrW32i4bjhyIInO29DoGNYRFZUuANY+4vD5JEvDiYbNYs3BB6OlI+gvcw8TS+BCVlO cBeRlSobOkHOi9KQFAmolKBfrSdBLibz8yEY01JG+F0rLJMa/PfMWOGymPHt51KkG4+F RqvFseohMNBikBxfjW5LBchPPz1QcNrsdO1lglp7xbFBLMsksxy5AnuKEJC+qKsQxTlv 0Q8sLXRHSsxWwvyl3/1dJiIfzcI0WNV9T9md8cirnhx+qA46Gi5zkhwn+GzvaB9T2n/9 cePA== 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 g5si1736687ejp.418.2019.10.09.12.15.06; Wed, 09 Oct 2019 12:15:06 -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 S1731680AbfJITLI (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:08 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:49027 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731144AbfJITLH (ORCPT ); Wed, 9 Oct 2019 15:11:07 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MK3FW-1iW6z83kZq-00LSxt; Wed, 09 Oct 2019 21:11:05 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 03/43] compat: itanic doesn't have one Date: Wed, 9 Oct 2019 21:10:03 +0200 Message-Id: <20191009191044.308087-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:me/MEPlFVpyxtVAUYxu6rBj0XDYCMOw6yYIMMAoP0u+lHXr9Rw8 HDntE6qFkqRh44fUDhevvaIXcFCCvAlj4ePAixc34Avd7/+Z8MSlEpnRDVXZvfnyNXxqce4 frZ/aiIXOEwDKzLpZJmMe7gYEToaqkgf41NU3LrB7s5wU8iD031Z5DDuGWuNazl5KHMHaNs XNkY49lDHzsJf6YFAqL5w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:CjsuizXD+es=:R8lkyNKPhuJHl0LetWM2wV oct9DZT/umpsZ7M03N7Jf4nci1dyYwQyDr9r7FgKhSiPWvXF7H/mnprZ6khx9db71RS0vD11u 17Us6mcJTAbAsyXAm0iOMhGr+iAdTV/BsvC+ESgDv3xswJ/CKGza4DuMLZBp18l7xdQmzW1Fy OQqCt6edF9gOLNhEF0OjTlR6P/1F2cZOnJ7uoa4cm0yP9+BkWLpYUL23e5Svx49S9WCDqpKYR X+odSSinrSmle1xTNLjbnbZTDTf36i8rfW4iSw8f+dz+cv08I0KLtkQQNXPBy5a5UHKtFTGsP /mK1JgG2qwu67Aimkf5wuzsQEeiBITcW5bf0mKWH3eOYJr8txGJ7xG8OBeL2WFCW3CykZRou7 5zUCetvdhXRE+OfvERpPiN82VLpcGZe42WYiAEVm5YP8jN1NcyN0X2mzJBp3+b5mnobgPyYYn lxjk/5/TtsK5W3jjvd5bgeJ0dSjNe1jKwlYkTW+AjazMo5iHiwLbj0rOvbNHHXQyij/F7xFgQ BvkH0Kq6giwPD0vsYYF8Qyi4/NZ/oY689Q3WgAOZttjeUjB4f16g6Pp8s2QBdMCiQO54TrwQM UQOOw3WzgoMu0e7TelQHxTn1I/Cxy4N/CYyAggvfhz938W9GvCFVMVT0tioNZwHMQzHm7D838 FPxdM9nFc/yU4K7H9CEolxFjuHqHTOwDXzYnZ/a9OMfQG54FHuQbiDkoRalgO+fP7BaVu+NJl avRAp1uDjym7wPUraisRpuZxFm84xmx2hx5/2aH4p1vrw1ZzKNueMtVWJsanTzh0Kc0s308xa MdxIda3a321xpxM9gxre+nCxhMYxaKd9N086iEi6I2ZSWEsseGI8RYGoG639idqQTz3keYwS2 E2n8y5p6hccLXcYTJlQg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro ... and hadn't for a long time. Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index a979b7d1ed90..46e8a8f8b6f1 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -468,7 +468,7 @@ static int rtc_ioctl(struct file *file, } /* on ia32 l_start is on a 32-bit boundary */ -#if defined(CONFIG_IA64) || defined(CONFIG_X86_64) +#if defined(CONFIG_X86_64) struct space_resv_32 { __s16 l_type; __s16 l_whence; @@ -1019,7 +1019,7 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, case FIOQSIZE: break; -#if defined(CONFIG_IA64) || defined(CONFIG_X86_64) +#if defined(CONFIG_X86_64) case FS_IOC_RESVSP_32: case FS_IOC_RESVSP64_32: error = compat_ioctl_preallocate(f.file, compat_ptr(arg)); From patchwork Wed Oct 9 19:10:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175676 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1175211ill; Wed, 9 Oct 2019 12:15:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwuJQQV4rw2pjHSl+4j6ZkGDo9EBM1T5ybgxxRMsh0NSIauKnQkIQRaCHyrvC3gRntM1nPN X-Received: by 2002:aa7:c513:: with SMTP id o19mr4402044edq.75.1570648516804; Wed, 09 Oct 2019 12:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648516; cv=none; d=google.com; s=arc-20160816; b=GdhlcMVDGPMpJD1rsydXMuBPaE4iAF8pnWxbQoqmOop6L61JsyOmzXZMCDIjOcAd4K RkH6uXiDZ7JGFmOXjA615hdJQgkau1T7RLnXXPNpcPwpBR0EMuSFhI60Fa3PTJMY+wnw D0x0VJsqAvJTLbugYwEDdNF7r/Wg8ZX5NzIejJ5Vcx48kHVUS1pJZthplGp1+rHquOvh +G+zFKlDz0H4p1kmjCvDD26dBxxoFifC9if7OahsBVpWRU97ZSc84pRZnn0vewrMwn9e boe5DSfEzB3D4DZRcJXoWWX6dMJHL1ZQtvPokp722i7/r3dUoIxL6as3KpriyqhRpZsE JMxA== 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=akJKq7CajYNK6iSW8f381IoD5iowkRl5NJIAIuzNLLs=; b=ml/Zy/bOlysAjzp/NETJFd4AndmkfQU9odqDoEVM1+4mh4PkviOHxztWbLn78zNf7F knTevRakp7h+pup3iPGzQ7GD0V2NdDZzLr1SOCYQpTZAkH+8Pc4kl4EQYwQz5nlexvPZ BL36gSMx/JF6GRBEufRJYGKcZVEjE/n+QlwNRP3oSGpgTQDmRM9zE8TEwWq1wK1pub5P pIcNA2/00obr4xG0mlL7C4BdgE9+KAZVawy64gauOPYlB9xGRtkzJqRTrIolwkf7krpm 3heujjkNtqmUjMmmlpXCWD/BqVBvWxvQ9h6BAt1v2m6VtqTSSwa/q8MMOHJ2eOqZYvtv Nakg== 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 si30si1754758ejb.92.2019.10.09.12.15.16; Wed, 09 Oct 2019 12:15:16 -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 S1732574AbfJITPO (ORCPT + 26 others); Wed, 9 Oct 2019 15:15:14 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:51401 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731426AbfJITLH (ORCPT ); Wed, 9 Oct 2019 15:11:07 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M9WiK-1iClaf0WZQ-005Zyd; Wed, 09 Oct 2019 21:11:05 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 04/43] do_vfs_ioctl(): use saner types Date: Wed, 9 Oct 2019 21:10:04 +0200 Message-Id: <20191009191044.308087-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:kI1DDnTQHZLrMsrnrpathDXXJIopBYJ0O6lp1B2pRerXDWJqHn/ wsPBCHkdQYk9Gj1skMySYJov8fvQIJjxLObPF++owo8gLEGGI7vt7Xc4mLXZzQaeZSeIdDU fZ2VkvXniRBx8AqZEl3jPzPDUqJDW7l3yq4/40BuiUt7Y5/Gb7FRvzW1SYAbdfYK0usEubq C8woHHxcu2zUTT+jCf6vw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:0MvSIDJkOzQ=:/vLRKdkLf60Ox1ToTaf0lN 7WRq0Nxmj1bbA6UUR53D5/DmUng15gn9dg47MBsoTOAymNui32gOt9oSBc0+KdJui1KKhAURi Wkei904HO9Ch7AMujiMiTOjb5yLP/d8Bz7lSf9eLdzfgP2IRke9z5hs+bDGtDzHgRKrLWzWeX zBdJsnsw/FHhCIg7JEGfIxGrGmYqS1T3t3SaaDa0bgDwo3HYu1uN5dhdSxT7vG8qMYGulPDPF i7zKXWrkG9w6d13ClGCoUngk5TOhh5VPelzMwyA0uM8KzKUT/2w5hE1E7yIrlMb9z+eZnfbfX +ZL1K5jznKp+ksiVZDamPL0CEuiov0M6+uS6MOrUEN8KIjInIfshBdEW+ejIdephWdV6w91oZ T28dL1+dT/0LYtmgcipTPEUjSCfBEQlgmCoo8inFDqgqm3VPLP1Dq3rnTW2Cf1PGQTcojvY9P SBrWhIMS3I5mYBAIyIvRylrPomvqsfO6T/aL+0DhTpffu9WLwDqnABq+8oIAdwW3qHtW6uXtk 62Vyhoawx2qdNJlSCaFzg68BllhWIy2ERZD8dCB0YLn4j9yAam84xa/ykK37DMYqcY5Om2sBz clCrngegzSOfUIWap6n8z0DiCvWEV/YZblpkUIGtO7Z1tFZfN5f1yECU05OP40FS+uCLdni0Y Tf/kynYTpT70IXxRy/2J/ilxDZE5wkHiiNaYeAfTHoTh1+CexqHerOye+C3VAMJb0Ck6Qzrbl q7UFCGkdbIHxlf8FwOuaGKLt/Ni4cPdcE+z8d/A0QAvHpu6jx78BFEANtQ/WqBI7I5NICqWwt qd7+neyAcFuyc+4D2hgq/2z956MY0vIGiw3/Wt5VQL0lWNUdbyD1lmFshHx1oUE36ITXntKJh 0k9sUJoCi1m2/lMGiuYA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro casting to pointer to int, only to pass that to function that takes pointer to void and uses it as pointer to structure is really asking for trouble. "Some pointer, I'm not sure what to" is spelled "void *", not "int *"; use that. And declare the functions we are passing that pointer to as taking the pointer to what they really want to access. Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/ioctl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.20.0 diff --git a/fs/ioctl.c b/fs/ioctl.c index fef3a6bf7c78..3f28b39f32f3 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -174,10 +174,9 @@ static int fiemap_check_ranges(struct super_block *sb, return 0; } -static int ioctl_fiemap(struct file *filp, unsigned long arg) +static int ioctl_fiemap(struct file *filp, struct fiemap __user *ufiemap) { struct fiemap fiemap; - struct fiemap __user *ufiemap = (struct fiemap __user *) arg; struct fiemap_extent_info fieinfo = { 0, }; struct inode *inode = file_inode(filp); struct super_block *sb = inode->i_sb; @@ -244,7 +243,8 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd, return ret; } -static long ioctl_file_clone_range(struct file *file, void __user *argp) +static long ioctl_file_clone_range(struct file *file, + struct file_clone_range __user *argp) { struct file_clone_range args; @@ -584,9 +584,9 @@ static int ioctl_fsthaw(struct file *filp) return thaw_super(sb); } -static int ioctl_file_dedupe_range(struct file *file, void __user *arg) +static int ioctl_file_dedupe_range(struct file *file, + struct file_dedupe_range __user *argp) { - struct file_dedupe_range __user *argp = arg; struct file_dedupe_range *same = NULL; int ret; unsigned long size; @@ -635,7 +635,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned long arg) { int error = 0; - int __user *argp = (int __user *)arg; + void __user *argp = (void __user *)arg; struct inode *inode = file_inode(filp); switch (cmd) { @@ -674,13 +674,13 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, break; case FS_IOC_FIEMAP: - return ioctl_fiemap(filp, arg); + return ioctl_fiemap(filp, argp); case FIGETBSZ: /* anon_bdev filesystems may not have a block size */ if (!inode->i_sb->s_blocksize) return -EINVAL; - return put_user(inode->i_sb->s_blocksize, argp); + return put_user(inode->i_sb->s_blocksize, (int __user *)argp); case FICLONE: return ioctl_file_clone(filp, arg, 0, 0, 0); From patchwork Wed Oct 9 19:10:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175677 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1175242ill; Wed, 9 Oct 2019 12:15:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWZlSR2ENYw1xkAas9ceB0DVpQhMd5/Piic5lc7LZf/IQDYWR6CDZGRn+PoiUiC1W1Sm7X X-Received: by 2002:a17:906:745:: with SMTP id z5mr4484152ejb.41.1570648518812; Wed, 09 Oct 2019 12:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648518; cv=none; d=google.com; s=arc-20160816; b=o+WzUoQ06z9S9sS2qOfcrj9p8/HquaTh44wYOuFY+BO5ht7scpn2ukAc/O+IweCzNo RjZp7CnScp7DJY5xuMlbvKcF9yTpbcOia/kZb+z4YkCcYAckc5nUXZvPOJB4WYPjA1+0 b/zUHxtnyfm9vkS6YHPpPkacnYHxFoX5q+cQQ3YKd2eNb861dacCIlM+jIywijKx84al ryq7fpeWtRoyMG6/W078Se0TlL200LCwbEOUSZK6YuylAN2vW8v0CXNYJENVNeaBuREH Xsg3G+g/GyUTNybZDI1oa8sEHWRI34IimJOHF/0f27zqPByL0fj2NocNzJw4hu2c+Bpj PK5A== 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=C/6+qn1vi2vgevX3vL9GXuyJQFVsI5FLEvnKPQ07mWk=; b=g2NXbimPDwJ4GOFMVSRboyrYhuN9ooQvKqy3jhAJpKM81SoMHQXfU9UOYeYoOLlm1k 6NQn9BxszPTr6t1VvqCekeKssJL4ub04FLZb1Kd0QbDbc8GZs/5a06JuhSevHvfWjpnI Snkd4hQ6fgjh+ybLLm6sXj8W5Q1JeI/X9JVeDeQQY1avYKHH1818ppFnJoOKDfGHmMJO 9gkzgqNtJYROvXScxmnhjU9zFlS6pqfro+zsDPJK3/+wankTtMXvohOMnbxciWOEewkn wYv4AQ0hCemnBuLtGg/0H97412lJLCTv9htiVD04oTksNmyOWj66lZ3R5fTcfvdfJrsL MnSQ== 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 si30si1754758ejb.92.2019.10.09.12.15.18; Wed, 09 Oct 2019 12:15:18 -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 S1732587AbfJITPR (ORCPT + 26 others); Wed, 9 Oct 2019 15:15:17 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:49547 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731254AbfJITLH (ORCPT ); Wed, 9 Oct 2019 15:11:07 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MlNYj-1hoyMW1KMH-00lpcY; Wed, 09 Oct 2019 21:11:05 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 05/43] compat: move FS_IOC_RESVSP_32 handling to fs/ioctl.c Date: Wed, 9 Oct 2019 21:10:05 +0200 Message-Id: <20191009191044.308087-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:rsGECA5U1Pe5E0luoyAv0WbzCrVjbsQOadFEWZ5NMCYNiZjylnu l5AG2Lwa7eM8lTTPAW292gekCpIw4QZxGwpxflTrtG2BDGKIpf1CN2Fl5l9GNrbXFFlS38E w2ZW30erZFv5JqXeNwH0pBcbw1RjwNJKb+TpsgUEfmyxdLqRpNtQXRVItdMM5xyq4aINV9o QDrteYoQYjcT2Lb8hfZQQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:k9SWxQ9A46E=:lP2JygFTkqc2drkSj6/yBE XK4ZqUNVpsvyjl5vBBOymBIrFQWcnaxvUhc/LCsPRUgc+Uy11/Gaq6ijurj0KYajjnJLto9Mg 16oDHj/fPWUbB9oAfQalgAn/xa/7h6AvdHw2Qox+EB27RvgZkxrVPAS87cI/QbJ4sIbYi6sYk E4h0EU1xUuM4HjEtoXHIqL9+CI1hJCx9z6m3ggTQyfcj2NLF+kXFVx2jS6cXKEYsBtI4GerVK tfMzjvAigi/u9jaufKbWwAFOHfh3rzvMCr+NjATrIaBNJHc2Vz3k86syucP2dfc5jbD9fu7Lk lJYE8fISka4IUCVHX3AuxzcQGSI8Pq8KoDMqWVtP30nTxUWRhZcwlWMY2eNCDEZCyBx0chsK9 arvsuaO1LzchSmGfUqJkD9t7Tx1ZEr2enXW2vdEaZNuz0rRfsBXsOQpmPNko9/ukaicr12KnI hbZFKY8EQ298JkolT+j852h7ESOl1pVtQgaTvzHnnD86XMALxLZyxczia59VESHuUf+qlqlAZ hy7mP8tqX8rGRDBiQ1AR05y6g9bKygQwCYHrDKmqw6ly0hy3FFPNG15jTQi7QaEfFOYu/SBsD U2If/yq7omoGMmXFaPbd7yTOWzndKD/tPiC287ZklEnLCLNgWwKgqcGOlcC6rLaEuA8aMibBI kzSZCNwzRs4DLA1NDEFkkRlJWEZ6JOkNLSW5Vt6bnsxV4EzI/BGwpm9a/XGXw6yZiiqqXET/t aprAN8ZlSJJcK7sjDTnlKGGsLV/dm8gAx+v0nfLYfeSqc8rAktmvMLm1fnH1aK3R9TwYBHkxe iu+NjzrE47vuHaAPpj2KLjocVOcmx9B0JfxpXpRjyXvWjc8XQxhgblNsffJ17gPR70oAyTtMr twtf4+O51liNOFwlTvwA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro ... and lose the ridiculous games with compat_alloc_user_space() there. Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 35 ----------------------------------- fs/ioctl.c | 29 +++++++++++++++++++++++++++++ include/linux/falloc.h | 20 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 35 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 46e8a8f8b6f1..ce995d4fa1f4 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -467,41 +467,6 @@ static int rtc_ioctl(struct file *file, return -ENOIOCTLCMD; } -/* on ia32 l_start is on a 32-bit boundary */ -#if defined(CONFIG_X86_64) -struct space_resv_32 { - __s16 l_type; - __s16 l_whence; - __s64 l_start __attribute__((packed)); - /* len == 0 means until end of file */ - __s64 l_len __attribute__((packed)); - __s32 l_sysid; - __u32 l_pid; - __s32 l_pad[4]; /* reserve area */ -}; - -#define FS_IOC_RESVSP_32 _IOW ('X', 40, struct space_resv_32) -#define FS_IOC_RESVSP64_32 _IOW ('X', 42, struct space_resv_32) - -/* just account for different alignment */ -static int compat_ioctl_preallocate(struct file *file, - struct space_resv_32 __user *p32) -{ - struct space_resv __user *p = compat_alloc_user_space(sizeof(*p)); - - if (copy_in_user(&p->l_type, &p32->l_type, sizeof(s16)) || - copy_in_user(&p->l_whence, &p32->l_whence, sizeof(s16)) || - copy_in_user(&p->l_start, &p32->l_start, sizeof(s64)) || - copy_in_user(&p->l_len, &p32->l_len, sizeof(s64)) || - copy_in_user(&p->l_sysid, &p32->l_sysid, sizeof(s32)) || - copy_in_user(&p->l_pid, &p32->l_pid, sizeof(u32)) || - copy_in_user(&p->l_pad, &p32->l_pad, 4*sizeof(u32))) - return -EFAULT; - - return ioctl_preallocate(file, p); -} -#endif - /* * simple reversible transform to make our table more evenly * distributed after sorting. diff --git a/fs/ioctl.c b/fs/ioctl.c index 3f28b39f32f3..9d26251f34a9 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -490,6 +490,35 @@ int ioctl_preallocate(struct file *filp, void __user *argp) return vfs_fallocate(filp, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len); } +/* on ia32 l_start is on a 32-bit boundary */ +#if defined CONFIG_COMPAT && defined(CONFIG_X86_64) +/* just account for different alignment */ +int compat_ioctl_preallocate(struct file *file, + struct space_resv_32 __user *argp) +{ + struct inode *inode = file_inode(file); + struct space_resv_32 sr; + + if (copy_from_user(&sr, argp, sizeof(sr))) + return -EFAULT; + + switch (sr.l_whence) { + case SEEK_SET: + break; + case SEEK_CUR: + sr.l_start += file->f_pos; + break; + case SEEK_END: + sr.l_start += i_size_read(inode); + break; + default: + return -EINVAL; + } + + return vfs_fallocate(file, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len); +} +#endif + static int file_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { diff --git a/include/linux/falloc.h b/include/linux/falloc.h index 674d59f4d6ce..fc61fdb9d1e9 100644 --- a/include/linux/falloc.h +++ b/include/linux/falloc.h @@ -29,4 +29,24 @@ struct space_resv { FALLOC_FL_INSERT_RANGE | \ FALLOC_FL_UNSHARE_RANGE) +/* on ia32 l_start is on a 32-bit boundary */ +#if defined(CONFIG_X86_64) +struct space_resv_32 { + __s16 l_type; + __s16 l_whence; + __s64 l_start __attribute__((packed)); + /* len == 0 means until end of file */ + __s64 l_len __attribute__((packed)); + __s32 l_sysid; + __u32 l_pid; + __s32 l_pad[4]; /* reserve area */ +}; + +#define FS_IOC_RESVSP_32 _IOW ('X', 40, struct space_resv_32) +#define FS_IOC_RESVSP64_32 _IOW ('X', 42, struct space_resv_32) + +int compat_ioctl_preallocate(struct file *, struct space_resv_32 __user *); + +#endif + #endif /* _FALLOC_H_ */ From patchwork Wed Oct 9 19:10:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175678 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1175386ill; Wed, 9 Oct 2019 12:15:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvBu+d150Em3f6pndMrW0WmrqGulyfHnGDN/xzEAoKw/GHk1KBL3/l7oxdnh7jfS6l/bGL X-Received: by 2002:a17:906:4908:: with SMTP id b8mr4319337ejq.83.1570648526276; Wed, 09 Oct 2019 12:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648526; cv=none; d=google.com; s=arc-20160816; b=j8GLhEMI96Bj8neNwmPH937Ye7AJmWSHeS8qTDx99kFgnVeDeJAxDXi8wVLEjgJfFh TW5V6QzlVvphxwhPmdW83n8HfzXgMtL8LjlVoE45vc698TdPsfxUESBYBNBFKk42LL7K bNc0HPkD/Vvx2/SsgKB9xweRAufotBSkWH9sR955Xws0BHVQpbfFOhFxeRG3fcZtsTh/ 5PGpp/GAVfdAgjBLZcUAeXY/Y8lmOhd5CTpB60tXO+OlT5Uyi4DLaK0jmvb3SNx275DH fy+y6qERahipi6GW/JRmCg0QsiRcqkQvACGV7ZPAoUtY6oka5hdIB3gh8j6EM0SNxUy0 G9ew== 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=kOXjdBZ29hS0UENJbH0M3TBpJnSFVZk8tMV/x/rwbf8=; b=ojl5JFJtMZnUktCT1g4GxW7oMw39HzGI/vNONN0vmcUcDRm4VVjfSRXZ0KRDfgXAMc OGfp1nWIbWX7XpsuAw5EeVz9s7SVHW+nx75BuEVjJan17gfQopInQqQ92xGWtVqsMI3F uRjdXjar5Sd/sHHoinGMJG/CR259CtQvlaR5W2XoTRuUCG7W4L8kzyVr8mLBMK+R1W8r iQQ1t2dtwAOckiYMYFaFBuQA3GwmLrjA9oJ75UQgAkUt5obEDaTsUdACGe6L06PjRtOC L8ZOBjgUu91QZE/BGNkQdcBwh/XCLXh1HJNaKUgr3RLRBaRLJZjELcKcyQam9ur4FGcJ Socg== 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 l45si2064636edc.185.2019.10.09.12.15.25; Wed, 09 Oct 2019 12:15:26 -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 S1732589AbfJITPZ (ORCPT + 26 others); Wed, 9 Oct 2019 15:15:25 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:47711 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730490AbfJITLH (ORCPT ); Wed, 9 Oct 2019 15:11:07 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MWAjC-1ibYVn29tK-00XaSj; Wed, 09 Oct 2019 21:11:05 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 06/43] compat_sys_ioctl(): make parallel to do_vfs_ioctl() Date: Wed, 9 Oct 2019 21:10:06 +0200 Message-Id: <20191009191044.308087-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:WOVEDt2np91eiK1oiQBp5uo+5rR4In1UdGh9NlEpbg6vm0omKcr a3KGO6PgQtVlWhhfEl3CfgF6SJvcwClHasJeqzVP/gVaagwqhhjYTkWjOqYlvKplGTAjeIr wFQiWC2yxSaJ2bCZVl5yuOyGcpGCfAgdTngpr2EvOsUDi5t/bcVP8fZZwsjCJewwfKra4ta K9yHvmpA5S+jX6ob/2ZTA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Qq913+1lsiY=:S/eqYoa/lf0TVLC4kpg5Zb s8aubOCVqEVZyXHXPU3kIvoCcP9M0y1Sbyt/n2DvzqCH+A+1Btt1GK4CbLDvLzYimMAJv7WL/ 1U4bGlXj9vhNF39rf5+fk2eaZC1DN3qZe9vuFDepDNlfiwBxE9kJa6ftnk2ciQaKFx5+F1RFz Gc9ktAF+NtQ7pV5RjNsImxOBVKP+f4rNebsNh9L0hdpsuJ+OBuE15p+1SNGkbByFoJj3oK1x0 r6t2SrRHmketKaPMCE2BduIjjMkF550H9Y0hygM1P8klPcq2qJocm1M584sJJUqiYtPNVxW/r u3OAiCEm3QJRzFfGjKbPbU6TkWHBYaRjcj+dfnAcMgNzNBBmHzjbOwhK4XVQkQ4YrbiN43MKU 9o/HMIuMRosfD9ZhZu0QDrbhzrNIDz4deIovRsPUPBsYVpctUMP/hrTOc4Zm8CoUlS5br7gRN Rlzm3A36hyLn9BZOsD6FBeYe4HslxJAPflRfd4+S0/fv1n6qctW17IspBfEcoYyFvMJVB7NC/ hryFw3mqP4ki5tqexOj1G8q9ePsPj75mpvBnEbzMNyNnORMuFGLAX08G6AY6MKu3FELKmq9qF 9ob3QrLX9WyorQ+pAmwxlMGvSPF/gvGOO1amVLm/4eeykY9ey0seTI/PORE1tNzQvVFNW8/++ xuhB3W5z6xfUqz3wVUD0DeH1bHK+aVmt3fOR1vs+kd6ZBnMlPWQplLq/4AfS4JV6Xu3U5fi8c rS4jJHGAmFOAmEtSNw7mra9EcDM0hyRy1aXmmyewFrGWUoxmXytB3EpmNSzTBaJUmrvVl2jaJ lmKzKVf7kOns6C8kIXlBXPCgy4zu72SJuhplCEZ6AIQDVPIFVHPLQHsuzevxWExlmpBIP0A/b rvNVT6WH8mNzOMTpTDOQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Handle ioctls that might be handled without reaching ->ioctl() in native case on the top level there. The counterpart of vfs_ioctl() (i.e. calling ->unlock_ioctl(), etc.) left as-is; eventually that would turn simply into the call of ->compat_ioctl(), but that'll take more work. Once that is done, we can move the remains of compat_sys_ioctl() into fs/ioctl.c and finally bury fs/compat_ioctl.c. Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 63 +++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 35 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index ce995d4fa1f4..ecbd5254b547 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -487,19 +487,7 @@ static unsigned int ioctl_pointer[] = { /* compatible ioctls first */ /* Little t */ COMPATIBLE_IOCTL(TIOCOUTQ) -/* Little f */ -COMPATIBLE_IOCTL(FIOCLEX) -COMPATIBLE_IOCTL(FIONCLEX) -COMPATIBLE_IOCTL(FIOASYNC) -COMPATIBLE_IOCTL(FIONBIO) -COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */ -COMPATIBLE_IOCTL(FS_IOC_FIEMAP) -/* 0x00 */ -COMPATIBLE_IOCTL(FIBMAP) -COMPATIBLE_IOCTL(FIGETBSZ) /* 'X' - originally XFS but some now in the VFS */ -COMPATIBLE_IOCTL(FIFREEZE) -COMPATIBLE_IOCTL(FITHAW) COMPATIBLE_IOCTL(FITRIM) #ifdef CONFIG_BLOCK /* Big S */ @@ -971,19 +959,39 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, if (error) goto out_fput; - /* - * To allow the compat_ioctl handlers to be self contained - * we need to check the common ioctls here first. - * Just handle them with the standard handlers below. - */ switch (cmd) { + /* these are never seen by ->ioctl(), no argument or int argument */ case FIOCLEX: case FIONCLEX: + case FIFREEZE: + case FITHAW: + case FICLONE: + goto do_ioctl; + /* these are never seen by ->ioctl(), pointer argument */ case FIONBIO: case FIOASYNC: case FIOQSIZE: - break; - + case FS_IOC_FIEMAP: + case FIGETBSZ: + case FICLONERANGE: + case FIDEDUPERANGE: + goto found_handler; + /* + * The next group is the stuff handled inside file_ioctl(). + * For regular files these never reach ->ioctl(); for + * devices, sockets, etc. they do and one (FIONREAD) is + * even accepted in some cases. In all those cases + * argument has the same type, so we can handle these + * here, shunting them towards do_vfs_ioctl(). + * ->compat_ioctl() will never see any of those. + */ + /* pointer argument, never actually handled by ->ioctl() */ + case FIBMAP: + goto found_handler; + /* handled by some ->ioctl(); always a pointer to int */ + case FIONREAD: + goto found_handler; + /* these two get messy on amd64 due to alignment differences */ #if defined(CONFIG_X86_64) case FS_IOC_RESVSP_32: case FS_IOC_RESVSP64_32: @@ -992,23 +1000,8 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, #else case FS_IOC_RESVSP: case FS_IOC_RESVSP64: - error = ioctl_preallocate(f.file, compat_ptr(arg)); - goto out_fput; -#endif - - case FICLONE: - goto do_ioctl; - case FICLONERANGE: - case FIDEDUPERANGE: - case FS_IOC_FIEMAP: - case FIGETBSZ: goto found_handler; - - case FIBMAP: - case FIONREAD: - if (S_ISREG(file_inode(f.file)->i_mode)) - break; - /*FALL THROUGH*/ +#endif default: if (f.file->f_op->compat_ioctl) { From patchwork Wed Oct 9 19:10:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175638 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1170649ill; Wed, 9 Oct 2019 12:11:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHoL8iM8wOV0yD7lTA4kRZsT0wooo2gn5vhYd6G8tJjHfWBOWSB8KigYBuLqQZnXu4dakb X-Received: by 2002:a05:6402:514:: with SMTP id m20mr4522586edv.187.1570648282611; Wed, 09 Oct 2019 12:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648282; cv=none; d=google.com; s=arc-20160816; b=bymYy680Cc4l0KaGpluhv44+LYzA3UPrwAuHRtrtfJlaAUdudZzjhAPmq160uLN0QL ag6Cj7CWA8z4qkn+gq8u8HIYt1eP3krShmGED+EbhkHA4e1gMCGB93HqQGFdP/00VrYE RQphYlZDufyw0gHcNLaeh/TXS0uX/VR+nY+2bUDcjrUDc2h7RM5/891VltSYeLDXZSr1 Y5N++5Xk7aRD13CjOxyQ9itkXjN4lOgFsDAmU1wr9tBqfSOKGwwrQ8Pcd5O5UhT8WYem l4AZgFwBW78UW2OagJ8+Wso0MvK+vx13Q68kU92Z+XrvhUsC8OR7NVNZF7Q6vBrJe02F jh5g== 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=Yh/ihm5eKYgJQz/BtaGxcV8f0+sQpnXVtkPWEFUu/gI=; b=YW0dR+tCCn+EmFtUokgz8ka4AXkrGN3ImhzxAaEY+kTA2nzhIcRZhRnw2zrwYVgEvt tbAy95zvLZgzdvxXhSPQJMVMbYcNB0wIBXldP++KPpjnfezeV70fubk1HnmL177VZuVv C3iz9COMUMw7Pfd8K+Z0wwbvOWOVvDyt7dzFHuxWeSFfR+JTUfgoKAYcHp70pRMbjIY4 wqNMqoP8aB17jn/pwq8XLgsL4GHDg0YPn8Hj+f7P0n8bo+b16BHPConpF33erBoPIqlN G9JE6nym4et7+SYyXZiBtqLagGj1ew3HY5xAPpmB4oD3f7kOEtxf/aCngMpwlBE33fpn 3Lzw== 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 g30si1996732eda.2.2019.10.09.12.11.22; Wed, 09 Oct 2019 12:11:22 -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 S1731967AbfJITLV (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:21 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:47187 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731743AbfJITLL (ORCPT ); Wed, 9 Oct 2019 15:11:11 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M3Upe-1iHjOl3o5S-000eI9; Wed, 09 Oct 2019 21:11:05 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , "Yan, Zheng" , stable@vger.kernel.org Subject: [PATCH v6 07/43] ceph: fix compat_ioctl for ceph_dir_operations Date: Wed, 9 Oct 2019 21:10:07 +0200 Message-Id: <20191009191044.308087-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:7W6XauET3AbuBxFZSMsMMQ6FckF/PqX6UCoZ0636GkXwX1Y3vhl F5pZo2Tdv9ccXuGFKDbatg3idUQlOfnVdGV1MqrPsoxTarqSwSZiSg3nnsHhTpyOBTp1j+z 5qEFufcDrhD7Q/AWIOFRwi1W1AAOENXFTdDym8PHZ0UBdt85kJ6UISjW+JTbcj6LBSRn5Vi wfltRDX28iQelblD8M3bg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:6nVuoYemKGc=:u8DjLT9sJqHQIOC8or8pHu dMxtm9JYzJs3CwtLNUWgd7NpqlUDmdRaKX+4BI6Z0is25N0w4NoQCeQ5oSvUxVVRzsFiUpA7S 0L5MfF8KSTzOxCRFNCmJUfmJFQD6v3ffxGrVmJerVbmKNuXVlddW+yOkqec6y2TUQChmu5NZd eRVfnqkUMqMaOGYUtuCj8+0UbCbhtryW08eSnSEYKokqJOkdFzuFFH3omX9DNGCJn9CoHAT6r qsAumB+ltwQAHDXxfrW1QublECT7J0D0nIaaoEQkfRTTyMGbwZiG1QftKJIQ0fA+BstWVjSqg uJa4tpkK3GaIdNLFfK5zomPlpBiPhv1f+h0gMWYNt6ag6gHqtN6WxqHQCy6KQcb9Z7pdOVNmo ND4Olt3QrfJM70RrNwRJ5KU0JXboZ5jnxVgLe43A/Hswdk03U5AiSWozZsi1MzDHZCmPTwC+o YZOuxINRbwKOQHGiOXJf31IFoer/oJjjSTI1JBf4vb2VyQcf7xrXg/xt0I3G7lbFYBgpyV279 6qg5qmNC4mfirlpC+TT7dRmUyrzrBfHIFX2SRGOqWD343jXqkKHBlLxJE/1XEBaL6GSFrJwPc WJpZFxpO3HeZH63TWxgf1FX2TXdZ8gF9g/aXN9fktPDlAYbPoCETKm/CwzlQZ9U08weecZZ44 eFRi1Cf8lTl72ti+J+a9FytZw+hzhcnW2UzuANcMuE4yQ9aCOQRb+MWI+HWHtckkjFaEajtuv ZsCSNX/AYBTjUVF/W0zzEid4XOWIYaISfnSLbk79Ivxo+rQlHtrzlwma25pRq9auM8Q9rDfBe iTpPQCyB3xLGGTjwHgMlYn3rTGSu6rvWNWR3r95DTE3RhUo3InG6yTkTHFJBfpTA70nKWTWhc l0yAP52a9viwO+vEy4iQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ceph_ioctl function is used both for files and directories, but only the files support doing that in 32-bit compat mode. For consistency, add the same compat handler to the dir operations as well, and use a handler that applies the appropriate compat_ptr() conversion. Reviewed-by: "Yan, Zheng" Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann --- fs/ceph/dir.c | 1 + fs/ceph/file.c | 2 +- fs/ceph/super.h | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) -- 2.20.0 diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 4ca0b8ff9a72..401c17d36b71 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1808,6 +1808,7 @@ const struct file_operations ceph_dir_fops = { .open = ceph_open, .release = ceph_release, .unlocked_ioctl = ceph_ioctl, + .compat_ioctl = ceph_compat_ioctl, .fsync = ceph_fsync, .lock = ceph_lock, .flock = ceph_flock, diff --git a/fs/ceph/file.c b/fs/ceph/file.c index d277f71abe0b..9e8e4bfe1d50 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -2162,7 +2162,7 @@ const struct file_operations ceph_file_fops = { .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write, .unlocked_ioctl = ceph_ioctl, - .compat_ioctl = ceph_ioctl, + .compat_ioctl = ceph_compat_ioctl, .fallocate = ceph_fallocate, .copy_file_range = ceph_copy_file_range, }; diff --git a/fs/ceph/super.h b/fs/ceph/super.h index f98d9247f9cb..87bf9db76f98 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -1123,6 +1124,15 @@ extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl); /* ioctl.c */ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg); +static inline long +ceph_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ +#ifdef CONFIG_COMPAT + return ceph_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +#else + return -ENOTTY; +#endif +} /* export.c */ extern const struct export_operations ceph_export_ops; From patchwork Wed Oct 9 19:10:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175675 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1175141ill; Wed, 9 Oct 2019 12:15:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqycOma4W/s9sDp74dlPp19VW0Um53+xjiYX+5XiOfXWE0FA4Eca/ncVwtS39SGEZUSd6+Dl X-Received: by 2002:a17:906:5502:: with SMTP id r2mr4468181ejp.3.1570648513207; Wed, 09 Oct 2019 12:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648513; cv=none; d=google.com; s=arc-20160816; b=DxcXe/KT671jBClK7gqHoeGYyHzXn54ReXuKenr6YOSdCWJ6p8S2UJ14uudq2gIbqA JmDFsJrk5vGjG4X69K9+kpgkGbq+/g1R9Zl5+zqOGvNAJtRLBOXA9YoX+aolOiMGjhwE 8x4slYSsgip9NDMc/SvKXCnD8wm8vNNAk4GXuw6NE1tvQgbARYbTkeKY/q+6eRhdSKVM /hFsnXB1IibC4aDZ49OSDrMDMrfMBVWv1xLtBdqk5nPmqYqpHeHy1lG7EX1AA89YpHRP 0qU+af6xLOUoBl0X8BSvn8Y8SXqHXtlb1FIKxVGvmZMbFI0DGNpYBML+OS2+Hh5bbH8f 7WTQ== 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=ZEY749pYweUTLjzFygx18Ep3N0Rrpwi9RmOxhhshRiQ=; b=Mo2nxx/+JRjsnoGEdxaQl0a2vViZRMPFOvBIo3x6UrTXNI7my2qCAaLLVfH73ElGTx U58sr50YchBC4S3ngHHFX96mINRmdU3MIdsV6lSBXUSLJbXFblhNhANyeSMZMIdyfeDB Zyl+hJnpuPY6JvXo3goLYt8g2bC22tXwHm7q/jXXfo4fiXJ5kOgrlF0qfBK12gyZ2/op 5ddHkJeO9vHTQrwgNh2ZFmgDAIGAYgyT7hqnQei9f3JLeQN82Hh1PN6sl8UUiC5L1zWG Fb00hoWbN+Eab/bFpTc0BSekM3uMNY14Dbcz3zl1FSNlfl4ga5jIRYnlantA5JOhJ/4U 4TYQ== 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 g5si1736687ejp.418.2019.10.09.12.15.13; Wed, 09 Oct 2019 12:15:13 -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 S1732565AbfJITPL (ORCPT + 26 others); Wed, 9 Oct 2019 15:15:11 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:50007 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731158AbfJITLH (ORCPT ); Wed, 9 Oct 2019 15:11:07 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MysmQ-1hvvA00PA2-00vtiP; Wed, 09 Oct 2019 21:11:06 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 08/43] compat_ioctl: drop FIOQSIZE table entry Date: Wed, 9 Oct 2019 21:10:08 +0200 Message-Id: <20191009191044.308087-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:a7QlAnOV7xXH9snDmC43ohpojU7Cxx5excOFhHsYBcQcOJ9DFCL TSPUaQ06MDh+fiJr8p5OLIErYcgJsAdgfmtr/Aio+NrpZEsgkA71CnXiU3CDOr5i4azd1yp nNDTMmOYw6uEVYIRmgt4OHganx/2wTzW5IatVrQ4sHQMIpDFEDKdMWfnC4EOQo53Main0Qc c8aS0R9d8HZoKrv8CoUcg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:oZv0b1Rd8Yk=:IlrKvEJW3uzEbJQfclRIm5 mX/CsGd0nN/QW3G8wrylVxgOwJXtkxLB4BfpwMWFsuHXCHtPksknaQLwWHZRPY41Ol6SwZQDC X/1rVGlJ/UwI8dxZLhINM4WsYm77SoVnF2PwS8iVjWWfLSXo6GuIaxv6bNT4sO9CU0mrXAyg4 k1QlEaF4UtLFt1kvRSrjZIIpKm6ATcMOWYQE4o/MUJl6MS9HG9lQb9QHEqlPcHAKO+p5tsqwp TUIa1dGYlXULRRUTu6PrneZ0FiWQJWxRwA97bvR/q5n4XmokfYZtlPWEv6CsAB+Cy08WWzDvP rDhhVsyS89r7umsxU3Emmy0RbGdcbJ4+Dzk5nC8jSVcv2YFnY7c/nlbAExm7knBscJM3Bk3wz iIOCp1tl99Tc5bwUfXFNDGj+kh4HtMypgeSHqXmC+kXxm1PjiHkLZubjTFMkeIOSEWFkwcJjP 4NH3zwIzMGMpNLF8HrJKYWnpEszEtOEQ5gpSnEyx+/c3/AXd2BUCizZC2FQPDCi5BNNJVlr8r s1vqVELmFfUBMJpTQuEm39IRq3lpDPbFkvJ63xhOAC+utZv3HmW7Ivjw7AVNkENKi9twyATWG cY3XyWkDVrVuq8JVQA9UShHoli8M/UFR34Lo2HOrRntwKbgsmHP7BXvK3Nb4BAY+EhVcQ9jPh zcFKuF9U0gNcKFgGuRmL8pMyD6Fc33GwgnATKNsVykEhgJlFMy4F1DfKkxTBzntaQ9Ut4IZQM LGIda6njS1yiHSpA83wh6Mw9Dd2IPuzGBmm9kAksXY/E7N79oYkMiBD9OSnqV0NP7UYkDtCeU t6giKE9Rtz1ljTSZKt/goNm7F1ubjcGGwQyaGNFnBi0nKkMgF0qT7ABL40p9SiDfpPuojb7Rj cuTJpHBXVf4eVJ2uUM2w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is already handled by the compat_ioctl() function itself. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 2 -- 1 file changed, 2 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index ecbd5254b547..cec3ec0a1727 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -528,8 +528,6 @@ COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ /* Little m */ COMPATIBLE_IOCTL(MTIOCTOP) -/* Socket level stuff */ -COMPATIBLE_IOCTL(FIOQSIZE) #ifdef CONFIG_BLOCK /* md calls this on random blockdevs */ IGNORE_IOCTL(RAID_VERSION) From patchwork Wed Oct 9 19:10:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175636 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1170516ill; Wed, 9 Oct 2019 12:11:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5OHyd4BYxQZsqCNvVgfHWkn49FuvlE62Xt8gThsXUu8wfQxJivAT6Gy+W76xfQnkeqgaC X-Received: by 2002:a17:906:c57:: with SMTP id t23mr4330044ejf.219.1570648274856; Wed, 09 Oct 2019 12:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648274; cv=none; d=google.com; s=arc-20160816; b=RtUHf4ORCWYqFHvhjfTwBbpWQPApa8smyWKnK7H/4IhajFfyQfT6G49s08t8amYCAN pxlPPq8fpwcwBiYCIS6vS6WpNf4ggwRatz30EBKJ+0qFAc0mOesAbjgNaUTVihHQd2jS VFvWxwcW30ai3WHKCT/ocqzRue156dCAXljcYyrlGajRWIqWX9qkEkYGBGAm7HHYBehd b4FimM7HZDOw3J1CU95wCLIeFcNwnalbGfBb+Z9KZK6dZ8Udua08CCvpaBF0Q/63gZj2 Krrrehm7nIC8sqZcQPeTozg0teKvMMG/lcvzSoHuX0WiKq0+EUamqUjRqzDSwzAy2BIB A9Zg== 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=eU9mMeBfGQPBg3i6HHq1JYtT46fr4hupgcL++DgRfYQ=; b=WR/DaDWwdFqIJ9M2FqMnH5yjiuR2wsGOz61ChV6wubP0FWQp46C2686+Y5W9h1KETl 06PedjzAB6AoQZkZeURdkVf1tln1BCwMPROtnXKkXzCSVHPY+v9NvVjD1Ozum2PZwHlI 2rpKjvpprZZB64tCgIx749ia9xUdrW6oB0YF5Fbiir6iRqDA5gl5HjmAynGaUbupoE0/ fa+z1S92+gEAgKhDDuuoF8d01VgKosUVEq/QqjDrHvfY/tHfTLe3UpEL/3HPo4KDcIkf rlOaeLgkjQoo6nttKpWiBDMGSj36QvmOwTzK4onZAjh9aSYiqVNgoLpVmPkm54mmnHZR vTtQ== 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 g30si1996732eda.2.2019.10.09.12.11.14; Wed, 09 Oct 2019 12:11:14 -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 S1731792AbfJITLM (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:12 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:42423 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731144AbfJITLK (ORCPT ); Wed, 9 Oct 2019 15:11:10 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MLzSD-1iaDr11Rab-00HuC6; Wed, 09 Oct 2019 21:11:06 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 09/43] compat_ioctl: add compat_ptr_ioctl() Date: Wed, 9 Oct 2019 21:10:09 +0200 Message-Id: <20191009191044.308087-9-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:CIXoOECmE4Ydk1Z/lGazuni0y3AvvhSKErUXxmDj6hoc/lGA6n1 n1JlKtouYc5tmlB+Q0qfvmbnzsEuxX7hKdQa2JHuL5CbZvzjIiuTQGKRq74WhfL6aTIaqQu ugfbzDyybpOxAhTqrHD7Xo3Y+Tnhg9Yme/2A73obzZ+qbRLV76a0k5db+nae2Zl1AsN45CK gtCOqiLMNHBYx/+WpJMug== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:L2RMaJB5fME=:MXyBXS3UeBoG8NcHVgoKuK MhLtWnuMnfitDST7C/KybKwwmxC8yLd9aolr0idFbtXPC6CbseSRmKmAFb1Wt3gctoigO09TG h0vo3IYCesuUmnVs8SRrAYReBXQ8P15VP6JxgXwhYB/neR6VADupowpTtFKsGUUup6KnROs6+ p+w06FOM7EkxXLz1+aX2BYY8yZ2ObSjaeJMNXYIcjeGRjnfpVNx7vkS+Vc+CkTSFI42dWt8/N f4TNoPEwHoDNUo0Z7ojIFDBgb2QVyD+770070FNgYrip6T0PeQKY2k0Ej2+NzByIfyFeIHclT GFgbbQM5TwJr0p+zOBEhR1+Ehzym4HvGYV8fv0UGrsUKhUGIv3UdLLskYKL0/q35fBVKWHgW1 KvD477V5wvPX+Z7YcSsvwCSJ5OXdr9XNn5yjvDLYwqixkUuJYFEHaHM+zgTkfF4xvM6xVDQ1e fgm3jqHglitHN/q0GWd4Ji7EKRQhA+6p4ZGc1lGKG/8oCUDAQe+x/GRL5uH2BbyHkq65RnCOZ LOB0bFrfbVEbEML7Q+hKl1fkz08eZXcWVGgj02M/aV2c0hGRh184tYG0HSa8oqY3LPWCY0hcr /H730wsVLn9EycoOWqgo09mXJd0YHb5ks/eJcTHJWWwDuy+qlZuS12fvv0A7H3E4Ks5K5xbW3 1cxSb2Nk9D23xcqeC4QV/mw9VLArrFmZTkMoPr8Uh3RGaEMrvleEOUzu2RaFC1qgrqoDQP/yQ jDm5nwfmDFYxuYrJ41njHCzr1VQAU0yCWAhF6ZB8z9r3oftMA77eUqD3xHW1ow52dlByyaMpw yQEZs3SjRLApN8tx+F8n2kc0hrXCP/2EYILdsSZ48BoEOqlucRA1rIYz+ZQy5rC8uxzvXklrj w1dVDe9K83tZ//NSsSKg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Many drivers have ioctl() handlers that are completely compatible between 32-bit and 64-bit architectures, except for the argument that is passed down from user space and may have to be passed through compat_ptr() in order to become a valid 64-bit pointer. Using ".compat_ptr = compat_ptr_ioctl" in file operations should let us simplify a lot of those drivers to avoid #ifdef checks, and convert additional drivers that don't have proper compat handling yet. On most architectures, the compat_ptr_ioctl() just passes all arguments to the corresponding ->ioctl handler. The exception is arch/s390, where compat_ptr() clears the top bit of a 32-bit pointer value, so user space pointers to the second 2GB alias the first 2GB, as is the case for native 32-bit s390 user space. The compat_ptr_ioctl() function must therefore be used only with ioctl functions that either ignore the argument or pass a pointer to a compatible data type. If any ioctl command handled by fops->unlocked_ioctl passes a plain integer instead of a pointer, or any of the passed data types is incompatible between 32-bit and 64-bit architectures, a proper handler is required instead of compat_ptr_ioctl. Signed-off-by: Arnd Bergmann --- v3: add a better description v2: use compat_ptr_ioctl instead of generic_compat_ioctl_ptrarg, as suggested by Al Viro --- fs/ioctl.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/fs.h | 7 +++++++ 2 files changed, 42 insertions(+) -- 2.20.0 diff --git a/fs/ioctl.c b/fs/ioctl.c index 9d26251f34a9..812061ba667a 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -748,3 +749,37 @@ SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) { return ksys_ioctl(fd, cmd, arg); } + +#ifdef CONFIG_COMPAT +/** + * compat_ptr_ioctl - generic implementation of .compat_ioctl file operation + * + * This is not normally called as a function, but instead set in struct + * file_operations as + * + * .compat_ioctl = compat_ptr_ioctl, + * + * On most architectures, the compat_ptr_ioctl() just passes all arguments + * to the corresponding ->ioctl handler. The exception is arch/s390, where + * compat_ptr() clears the top bit of a 32-bit pointer value, so user space + * pointers to the second 2GB alias the first 2GB, as is the case for + * native 32-bit s390 user space. + * + * The compat_ptr_ioctl() function must therefore be used only with ioctl + * functions that either ignore the argument or pass a pointer to a + * compatible data type. + * + * If any ioctl command handled by fops->unlocked_ioctl passes a plain + * integer instead of a pointer, or any of the passed data types + * is incompatible between 32-bit and 64-bit architectures, a proper + * handler is required instead of compat_ptr_ioctl. + */ +long compat_ptr_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + if (!file->f_op->unlocked_ioctl) + return -ENOIOCTLCMD; + + return file->f_op->unlocked_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +} +EXPORT_SYMBOL(compat_ptr_ioctl); +#endif diff --git a/include/linux/fs.h b/include/linux/fs.h index e0d909d35763..0b4d8fc79e0f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1727,6 +1727,13 @@ int vfs_mkobj(struct dentry *, umode_t, extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); +#ifdef CONFIG_COMPAT +extern long compat_ptr_ioctl(struct file *file, unsigned int cmd, + unsigned long arg); +#else +#define compat_ptr_ioctl NULL +#endif + /* * VFS file helper functions. */ From patchwork Wed Oct 9 19:10:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175672 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1174851ill; Wed, 9 Oct 2019 12:14:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEIFvDzdicAMebzY6/XDRsRF3pDu9P9rHJklUXswM95tiJA6mr3V2go5i3fhvtBR7qrwcL X-Received: by 2002:a17:907:20c8:: with SMTP id qq8mr4296188ejb.311.1570648496521; Wed, 09 Oct 2019 12:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648496; cv=none; d=google.com; s=arc-20160816; b=WFkYsVHWnjKP+ahWKB4ON/6Q5OLsSLk9tH2WXAmH57w/NBOjNCSGUp1BnLGVDD7EMj Lz7nIcbwHGXIurBtUvdydLzjWHgdItU+5b/1Hhs0h1BkaLBQyESmP3mSRbe8ViLG6oFa bAMRNnzPe60blaliUMsGXv7Ssi2kE3dP7ao0Qx4Iv18t/3xnekByIjyfAH+xgx4Xh2Fn 9PDZVIvnF/gCpip2LuqMGGNQPUaWLUvaxk6wd1VdL++CrStxYYc0DSB89idrq3v69uMR mvOvJjA6ZIOY7iCBkiFkMMzDpqXcDYfu5y0bi+LNhhVCxIoFRzvLkXg2z2dZhNpClo2s On8A== 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=5bAwPiy6VlqoQ2OhI9XDVCF+9/wzNuRXVxb+l6Pk2ck=; b=aItdeJeP6LQhja+vAieIzowUPOkKCUAP1s3CtxOLj3HXZE+bKvdmRYgdituHNy374a csLT69ifLRx1BVx6N3SDDAOoz0Rxg7/GbKJDacqhDbX838fYWEElyeNQRPitx9hHlmH7 BHLg8OcIBux/iebVve0oG5QyxyGQWNPGfwJGaC83isgE/icFjdXGDtfoeC0H5rbH7Pkz XKTB5GWW9AkpRFq5iX7w1FaP0vwx5oKmvrO+Mow4y1fQ0BHG5djl8E8FMU86FoPdMt+n 7Vv6faoTLcaqjQzU6tCe29Iq6S5QHV+9NLxH+3EhYPnUPn40jzLNKeESsZRbPKlXD7bz To6w== 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 e22si2005231eda.300.2019.10.09.12.14.56; Wed, 09 Oct 2019 12:14:56 -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 S1731762AbfJITLL (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:11 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:57341 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731658AbfJITLJ (ORCPT ); Wed, 9 Oct 2019 15:11:09 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MsI8Y-1hy98y2TMI-00thr3; Wed, 09 Oct 2019 21:11:06 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Alexandre Belloni Subject: [PATCH v6 10/43] compat_ioctl: move rtc handling into rtc-dev.c Date: Wed, 9 Oct 2019 21:10:10 +0200 Message-Id: <20191009191044.308087-10-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:NQxqHSuGm6672yi9tDjAjsm8/dbLhBUkstX4vP7G+9ZMcvTby8W sKD2xfDzsdRF+p1GLGd0QNFRiF+/YHOkRN6q/4b/Mfh9ooShBkCwkF9rKfvZinq075xadWk NMO0TEAb7bSZVQYiVqRG17LK0STeNDYZEpFVH8qqZ1aTT/VqdkTfBOONE8hGLEUnzxr2Wdd JYY8aGIzV63Vw25jZT/IQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:cLaxGJXuAWg=:4OrBjJuOS2p5ASTVKjHPsH PZfr0hCMMahWEMBlJzs9c28BDfty6anoTXNUD+q2xiVW4Bx4xqIBohxza0pptizLNixKkf0TS Z9Kp7/tknxmkAP+nT3jAM1oHOO0vTJslYoGyRQ246HZzAneMc1CBmoGi302P9I280q2kzM7tq ojwQxoY1I02R1V4/5Gs4ApifFToGn/0c2ukkWo319xLrIksjM2l4x8Oxpcbzr0FyHBPMbSwka Tr95M0OKFHN+6o8Vf3Nk0bndfrSqE81y1x0UOZCYz1Xn3hrbvnu+8KOBcqiHknnEZHlNtLZp7 qJCNNHssim97u7JTeX0XNWzVbhAdz8w711uPXbThA4IwLQUScYloyzFVfqlu6ZQ37ixIcFB0R NqJ7fBDdgQFUvY01r4og2gFb62JSMm/krk7AJf0JEFKp6d6RvfoJyT0KO1pIQ5GPBJjOec4d+ gO5Id56fR54XX+nqdfuVPit8+RQwlbmVtohvlOy1taNUUyPtmFomI03LKi4aaU08/ljsdg6Sn 8HEhJWWV9PHcgGqCp2wdE+hgKLw4isVNpNjypYtqEyjWX+BiHuCdQ8aQE/HBTq4yUgN/+gqWB bNNhkPwS02kg1aoBNPht/FCrqFmVoaSRq0Pd5ZIRPseYVMjnG8NqpXe+WC/YcNwfeUhCtOxrb dIcr8tJzkWmP79l56V7b8dxOq30hV3oOkZB9CkPAI34o8JbylxG1T0iSoMtY/Dzzttm5/3sDY JDlCFw8IYxcF7g9S980KImExtiU9H9gmL8zj1W3zd4gj8aK5X+euNaxqE8gPphehqyqn39l4J fpEpARhiWL7dNomRUsLzYFns+5SrkKEfFtqgo3CbOB3IJDwx4ABjfdr2owl3mn9jBe/IUJKrq vwTiZutfrYPKjY1qIpMg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We no longer need the rtc compat handling to be in common code, now that all drivers are either moved to the rtc-class framework, or (rarely) exist in drivers/char for architectures without compat mode (m68k, alpha and ia64, respectively). I checked the list of ioctl commands in drivers, and the ones that are not already handled are all compatible, again with the one exception of m68k driver, which implements RTC_PLL_GET and RTC_PLL_SET, but has no compat mode. Since the ioctl commands are either compatible or differ in both structure and command code between 32-bit and 64-bit, we can merge the compat handler into the native one and just implement the two common compat commands (RTC_IRQP_READ, RTC_IRQP_SET) there. The result is a slight change in behavior, as a native 64-bit process will now also handle the 32-bit commands (RTC_IRQP_SET32/RTC_IRQP_SET). The old conversion handler also deals with RTC_EPOCH_READ and RTC_EPOCH_SET, which are not handled in rtc-dev.c but only in a single device driver (rtc-vr41xx), so I'm adding the compat version in the same place. I don't expect other drivers to need those commands in the future. Acked-by: Alexandre Belloni Signed-off-by: Arnd Bergmann --- v2: merge compat handler into ioctl function to avoid the compat_alloc_user_space() roundtrip, based on feedback from Al Viro. --- drivers/rtc/dev.c | 13 +++++++++- drivers/rtc/rtc-vr41xx.c | 10 ++++++++ fs/compat_ioctl.c | 53 ---------------------------------------- 3 files changed, 22 insertions(+), 54 deletions(-) -- 2.20.0 Reviewed-by: Ben Hutchings diff --git a/drivers/rtc/dev.c b/drivers/rtc/dev.c index 84feb2565abd..1dc5063f78c9 100644 --- a/drivers/rtc/dev.c +++ b/drivers/rtc/dev.c @@ -10,6 +10,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -357,10 +358,19 @@ static long rtc_dev_ioctl(struct file *file, mutex_unlock(&rtc->ops_lock); return rtc_update_irq_enable(rtc, 0); +#ifdef CONFIG_64BIT +#define RTC_IRQP_SET32 _IOW('p', 0x0c, __u32) +#define RTC_IRQP_READ32 _IOR('p', 0x0b, __u32) + case RTC_IRQP_SET32: + err = rtc_irq_set_freq(rtc, arg); + break; + case RTC_IRQP_READ32: + err = put_user(rtc->irq_freq, (unsigned int __user *)uarg); + break; +#endif case RTC_IRQP_SET: err = rtc_irq_set_freq(rtc, arg); break; - case RTC_IRQP_READ: err = put_user(rtc->irq_freq, (unsigned long __user *)uarg); break; @@ -434,6 +444,7 @@ static const struct file_operations rtc_dev_fops = { .read = rtc_dev_read, .poll = rtc_dev_poll, .unlocked_ioctl = rtc_dev_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = rtc_dev_open, .release = rtc_dev_release, .fasync = rtc_dev_fasync, diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index c75230562c0d..79f27de545af 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c @@ -4,6 +4,7 @@ * * Copyright (C) 2003-2008 Yoichi Yuasa */ +#include #include #include #include @@ -66,6 +67,10 @@ static void __iomem *rtc2_base; #define rtc2_read(offset) readw(rtc2_base + (offset)) #define rtc2_write(offset, value) writew((value), rtc2_base + (offset)) +/* 32-bit compat for ioctls that nobody else uses */ +#define RTC_EPOCH_READ32 _IOR('p', 0x0d, __u32) +#define RTC_EPOCH_SET32 _IOW('p', 0x0e, __u32) + static unsigned long epoch = 1970; /* Jan 1 1970 00:00:00 */ static DEFINE_SPINLOCK(rtc_lock); @@ -179,6 +184,11 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long switch (cmd) { case RTC_EPOCH_READ: return put_user(epoch, (unsigned long __user *)arg); +#ifdef CONFIG_64BIT + case RTC_EPOCH_READ32: + return put_user(epoch, (unsigned int __user *)arg); + case RTC_EPOCH_SET32: +#endif case RTC_EPOCH_SET: /* Doesn't support before 1900 */ if (arg < 1900) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index cec3ec0a1727..47da220f95b1 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -436,37 +435,6 @@ static int mt_ioctl_trans(struct file *file, #define HCIUARTSETFLAGS _IOW('U', 203, int) #define HCIUARTGETFLAGS _IOR('U', 204, int) -#define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t) -#define RTC_IRQP_SET32 _IOW('p', 0x0c, compat_ulong_t) -#define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t) -#define RTC_EPOCH_SET32 _IOW('p', 0x0e, compat_ulong_t) - -static int rtc_ioctl(struct file *file, - unsigned cmd, void __user *argp) -{ - unsigned long __user *valp = compat_alloc_user_space(sizeof(*valp)); - int ret; - - if (valp == NULL) - return -EFAULT; - switch (cmd) { - case RTC_IRQP_READ32: - case RTC_EPOCH_READ32: - ret = do_ioctl(file, (cmd == RTC_IRQP_READ32) ? - RTC_IRQP_READ : RTC_EPOCH_READ, - (unsigned long)valp); - if (ret) - return ret; - return convert_in_user(valp, (unsigned int __user *)argp); - case RTC_IRQP_SET32: - return do_ioctl(file, RTC_IRQP_SET, (unsigned long)argp); - case RTC_EPOCH_SET32: - return do_ioctl(file, RTC_EPOCH_SET, (unsigned long)argp); - } - - return -ENOIOCTLCMD; -} - /* * simple reversible transform to make our table more evenly * distributed after sorting. @@ -503,21 +471,6 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) /* Big V (don't complain on serial console) */ IGNORE_IOCTL(VT_OPENQRY) IGNORE_IOCTL(VT_GETMODE) -/* Little p (/dev/rtc, /dev/envctrl, etc.) */ -COMPATIBLE_IOCTL(RTC_AIE_ON) -COMPATIBLE_IOCTL(RTC_AIE_OFF) -COMPATIBLE_IOCTL(RTC_UIE_ON) -COMPATIBLE_IOCTL(RTC_UIE_OFF) -COMPATIBLE_IOCTL(RTC_PIE_ON) -COMPATIBLE_IOCTL(RTC_PIE_OFF) -COMPATIBLE_IOCTL(RTC_WIE_ON) -COMPATIBLE_IOCTL(RTC_WIE_OFF) -COMPATIBLE_IOCTL(RTC_ALM_SET) -COMPATIBLE_IOCTL(RTC_ALM_READ) -COMPATIBLE_IOCTL(RTC_RD_TIME) -COMPATIBLE_IOCTL(RTC_SET_TIME) -COMPATIBLE_IOCTL(RTC_WKALM_SET) -COMPATIBLE_IOCTL(RTC_WKALM_RD) /* * These two are only for the sbus rtc driver, but * hwclock tries them on every rtc device first when @@ -897,12 +850,6 @@ static long do_ioctl_trans(unsigned int cmd, case MTIOCPOS32: return mt_ioctl_trans(file, cmd, argp); #endif - /* Not implemented in the native kernel */ - case RTC_IRQP_READ32: - case RTC_IRQP_SET32: - case RTC_EPOCH_READ32: - case RTC_EPOCH_SET32: - return rtc_ioctl(file, cmd, argp); } /* From patchwork Wed Oct 9 19:10:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175646 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171568ill; Wed, 9 Oct 2019 12:12:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUAIAobG5PStmXvDfJSDlz6sqC15kSGbXBDdF/esOCm8K6pnw5dunAeHddtC0QoLOQAof8 X-Received: by 2002:a17:907:4150:: with SMTP id od24mr4284877ejb.135.1570648325341; Wed, 09 Oct 2019 12:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648325; cv=none; d=google.com; s=arc-20160816; b=MU7vVOZvPXW7TqfB9bnq3zExC7dZVqSCY57K5LxWNP/o6soPPceCkOfEcMRe0CMoFd OPL6sQ+NnDbbK95/DTVqZJZz0B23HaGAOu1xo1xRfDgw/ynsQpWWt+KgLFS9U6hqcuQL tiyn8YYI5I2ci5S0snprfSNnW2gtoWHp/jqvCXYShGv44vzBEs9OznghkA0RLI7xBQ84 VZU/aoaU1yfaRCqHhgjTiwP1qPtNVlG/hAtx9Txf/Bwas9Mnz/EH4/W1xbH1RUHXgNQF CTwpbjvCjrgBuiNh/0XbH6ABqT4cUf9xUMZheoIo8TTH9NWMmp65zyfOUBZirUQgcNfs adyg== 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=x/Yej0pHNkuB3zQeDY1x3INt4rm6En/5TsR+ZWrs6AY=; b=Gdc1MpabnqUmMiHGLSycSBZ5hMrMkraubXREXISoOgXJ5EacRrf1Nf/4OIFvWJOMCS 4iMnlfx1PrdoyDAUB8HyMjjHHwQNTw0VsiFsZMLfbhMjKYQK5jdtS8GFOfssyn5iS6p6 0waERWlFfgR9zvuCq7+iSsmxRZE5YF5jvL423yihzH2bfojUuKS9JF1Uy6TMj1BwyO2P zCrD9OWWOdwVZDoIVTCMUGicKkyWHqDqiWh7rp7UJptWOq4K6eWlt8btBS0wXZ4K931j 1jPJXRssSBWimtnvNCi9jUJI4sSK1ytUKUE5MTRYY2grd1EPshLNJWi1y71jXz3+G2Ch JFCg== 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 gh16si1676469ejb.150.2019.10.09.12.12.04; Wed, 09 Oct 2019 12:12:05 -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 S1732227AbfJITMD (ORCPT + 26 others); Wed, 9 Oct 2019 15:12:03 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:40447 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732108AbfJITLj (ORCPT ); Wed, 9 Oct 2019 15:11:39 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MJVY8-1iXksW0kIq-00Jp4Z; Wed, 09 Oct 2019 21:11:08 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , "Michael S . Tsirkin" , "David S . Miller" , Jarkko Sakkinen , Jason Gunthorpe , Jiri Kosina , Stefan Hajnoczi , Cornelia Huck Subject: [PATCH v6 11/43] compat_ioctl: move drivers to compat_ptr_ioctl Date: Wed, 9 Oct 2019 21:10:11 +0200 Message-Id: <20191009191044.308087-11-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:bP7fdiVUu+Itn3CHuMhzn2qvWzozcM9kwrSxFUh1TCC9Y6eDf0l K+mPZPDzrLBwEuf2Mrx0JZxKLhlnio0KmuoVQflsMe8c6+8SrAOQsQTxMG8it0UoZH1lp3L s/l8axWMeIzF+Gu+xucMlvQKtetjM8YBWVYzCs4zudR5Utt9vWrYGNrd7q0DhjoDM6DCssr YDEUB7uuyidTlHTX2bUEQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:LDTojX204aY=:/V5Sb1PihiYB+4abRsUcMP BNP4DipOpDE0AHhGVuzXPLy9kNqFqXlqbZ93TAixwNZfVxe/oKZBERtg8TBTQrn2DhftI0zv9 7S/RJEa5PZ1qAybzh5Hqd3FOL9wjfHtZaDf2o2wrJEoqy7mjNxgO0t9maBtjGDIrTArH9Z7Rl fKPi3Gig0vAZxZCWQ5Z/uUO9g+IBv9+DIIsT19LylY6V/k7poFEaXA0Uhjkl362LuYwXvz98O vnk84gpXZcSoygXZuTDHssrI2Vh5ucIrvLVvDgzQhLL/53gijjunaqJ0cSE/eOfTuvJ//jUDm Nt1l04H1dCUCy0/EBVdn4B30o6gr02Vclwmt+eHYzne83AIifLkX1w95DJqXXal+bGKKMvDBq 11adKJrsSQm1/CS2j/3MkL+cV9zkjT11PDxkAtuO5bEJeKd7MULyizJlN7BAdnRCgbevneHRc MaO/1L2Tze4HtPIH3iwqcVE1BFnVmsolQWrZIsZNkQ8D17mXsAPszaQs11LxxD4Ym56Ee8Vx5 woGUYyVU6Qh9g/sEjW2k32mWJnHD9X6yKgZPmAULa8/NZ3JGtrCx1RMcLLkHiZ8/W/BMP+LFr 5PqDaOqIuw2xOVN1VA3yW0E4rkhNSSscd9HP1Ju68DJyRcNYBuZzBfsi/qM5Uss+1St63TdJB AGN5lJGfcu2R5B/GdGqRLFh/N8tZkg2eReNUeSkarO6YJ3tiMVXcVF97IQGsuSeDWH7geQRQU C5QEh+3Hbh+MzOsew25triC8Jef/FFBIF+X7HULZy1PmpatTMPGzJl72pbaK7fj8SxL+u54Gz d+25hwesVABLptyPp2VzCALxiJuXnhhE/7iZqJZxBgbcuo/dauMX+3iRqUo0/TOjyvDcOonQ6 dqRoL5kle0ByFhYzamFg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each of these drivers has a copy of the same trivial helper function to convert the pointer argument and then call the native ioctl handler. We now have a generic implementation of that, so use it. Acked-by: Greg Kroah-Hartman Acked-by: Michael S. Tsirkin Acked-by: David S. Miller Reviewed-by: Jarkko Sakkinen Reviewed-by: Jason Gunthorpe Reviewed-by: Jiri Kosina Reviewed-by: Stefan Hajnoczi Reviewed-by: Cornelia Huck Signed-off-by: Arnd Bergmann --- drivers/char/ppdev.c | 12 +--------- drivers/char/tpm/tpm_vtpm_proxy.c | 12 +--------- drivers/firewire/core-cdev.c | 12 +--------- drivers/hid/usbhid/hiddev.c | 11 +-------- drivers/hwtracing/stm/core.c | 12 +--------- drivers/misc/mei/main.c | 22 +---------------- drivers/mtd/ubi/cdev.c | 36 +++------------------------- drivers/net/tap.c | 12 +--------- drivers/staging/pi433/pi433_if.c | 12 +--------- drivers/usb/core/devio.c | 16 +------------ drivers/vfio/vfio.c | 39 +++---------------------------- drivers/vhost/net.c | 12 +--------- drivers/vhost/scsi.c | 12 +--------- drivers/vhost/test.c | 12 +--------- drivers/vhost/vsock.c | 12 +--------- fs/ceph/dir.c | 2 +- fs/ceph/file.c | 2 +- fs/ceph/super.h | 9 ------- fs/fat/file.c | 13 +---------- 19 files changed, 22 insertions(+), 248 deletions(-) -- 2.20.0 Acked-by: Jarkko Sakkinen diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index c86f18aa8985..e02fe2621b94 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -670,14 +670,6 @@ static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return ret; } -#ifdef CONFIG_COMPAT -static long pp_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static int pp_open(struct inode *inode, struct file *file) { unsigned int minor = iminor(inode); @@ -786,9 +778,7 @@ static const struct file_operations pp_fops = { .write = pp_write, .poll = pp_poll, .unlocked_ioctl = pp_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = pp_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = pp_open, .release = pp_release, }; diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c b/drivers/char/tpm/tpm_vtpm_proxy.c index 2f6e087ec496..91c772e38bb5 100644 --- a/drivers/char/tpm/tpm_vtpm_proxy.c +++ b/drivers/char/tpm/tpm_vtpm_proxy.c @@ -670,20 +670,10 @@ static long vtpmx_fops_ioctl(struct file *f, unsigned int ioctl, } } -#ifdef CONFIG_COMPAT -static long vtpmx_fops_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vtpmx_fops_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations vtpmx_fops = { .owner = THIS_MODULE, .unlocked_ioctl = vtpmx_fops_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vtpmx_fops_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 1da7ba18d399..c777088f5828 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -1646,14 +1646,6 @@ static long fw_device_op_ioctl(struct file *file, return dispatch_ioctl(file->private_data, cmd, (void __user *)arg); } -#ifdef CONFIG_COMPAT -static long fw_device_op_compat_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -{ - return dispatch_ioctl(file->private_data, cmd, compat_ptr(arg)); -} -#endif - static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) { struct client *client = file->private_data; @@ -1795,7 +1787,5 @@ const struct file_operations fw_device_ops = { .mmap = fw_device_op_mmap, .release = fw_device_op_release, .poll = fw_device_op_poll, -#ifdef CONFIG_COMPAT - .compat_ioctl = fw_device_op_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 1f9bc4483465..e421cdf2d1a4 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -854,13 +854,6 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return r; } -#ifdef CONFIG_COMPAT -static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - return hiddev_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations hiddev_fops = { .owner = THIS_MODULE, .read = hiddev_read, @@ -870,9 +863,7 @@ static const struct file_operations hiddev_fops = { .release = hiddev_release, .unlocked_ioctl = hiddev_ioctl, .fasync = hiddev_fasync, -#ifdef CONFIG_COMPAT - .compat_ioctl = hiddev_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index 603b83ac5085..2712e699ba08 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -832,23 +832,13 @@ stm_char_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return err; } -#ifdef CONFIG_COMPAT -static long -stm_char_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - return stm_char_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#else -#define stm_char_compat_ioctl NULL -#endif - static const struct file_operations stm_fops = { .open = stm_char_open, .release = stm_char_release, .write = stm_char_write, .mmap = stm_char_mmap, .unlocked_ioctl = stm_char_ioctl, - .compat_ioctl = stm_char_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = no_llseek, }; diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 7310b476323c..133fa8cbb1c8 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -532,24 +532,6 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data) return rets; } -/** - * mei_compat_ioctl - the compat IOCTL function - * - * @file: pointer to file structure - * @cmd: ioctl command - * @data: pointer to mei message structure - * - * Return: 0 on success , <0 on error - */ -#ifdef CONFIG_COMPAT -static long mei_compat_ioctl(struct file *file, - unsigned int cmd, unsigned long data) -{ - return mei_ioctl(file, cmd, (unsigned long)compat_ptr(data)); -} -#endif - - /** * mei_poll - the poll function * @@ -898,9 +880,7 @@ static const struct file_operations mei_fops = { .owner = THIS_MODULE, .read = mei_read, .unlocked_ioctl = mei_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = mei_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = mei_open, .release = mei_release, .write = mei_write, diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 1b77fff9f892..cc9a28cf9d82 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -1078,36 +1078,6 @@ static long ctrl_cdev_ioctl(struct file *file, unsigned int cmd, return err; } -#ifdef CONFIG_COMPAT -static long vol_cdev_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - unsigned long translated_arg = (unsigned long)compat_ptr(arg); - - return vol_cdev_ioctl(file, cmd, translated_arg); -} - -static long ubi_cdev_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - unsigned long translated_arg = (unsigned long)compat_ptr(arg); - - return ubi_cdev_ioctl(file, cmd, translated_arg); -} - -static long ctrl_cdev_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - unsigned long translated_arg = (unsigned long)compat_ptr(arg); - - return ctrl_cdev_ioctl(file, cmd, translated_arg); -} -#else -#define vol_cdev_compat_ioctl NULL -#define ubi_cdev_compat_ioctl NULL -#define ctrl_cdev_compat_ioctl NULL -#endif - /* UBI volume character device operations */ const struct file_operations ubi_vol_cdev_operations = { .owner = THIS_MODULE, @@ -1118,7 +1088,7 @@ const struct file_operations ubi_vol_cdev_operations = { .write = vol_cdev_write, .fsync = vol_cdev_fsync, .unlocked_ioctl = vol_cdev_ioctl, - .compat_ioctl = vol_cdev_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; /* UBI character device operations */ @@ -1126,13 +1096,13 @@ const struct file_operations ubi_cdev_operations = { .owner = THIS_MODULE, .llseek = no_llseek, .unlocked_ioctl = ubi_cdev_ioctl, - .compat_ioctl = ubi_cdev_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; /* UBI control character device operations */ const struct file_operations ubi_ctrl_cdev_operations = { .owner = THIS_MODULE, .unlocked_ioctl = ctrl_cdev_ioctl, - .compat_ioctl = ctrl_cdev_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = no_llseek, }; diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 3ae70c7e6860..a6d63665ad03 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -1123,14 +1123,6 @@ static long tap_ioctl(struct file *file, unsigned int cmd, } } -#ifdef CONFIG_COMPAT -static long tap_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - return tap_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations tap_fops = { .owner = THIS_MODULE, .open = tap_open, @@ -1140,9 +1132,7 @@ static const struct file_operations tap_fops = { .poll = tap_poll, .llseek = no_llseek, .unlocked_ioctl = tap_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = tap_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 40c6f4e7632f..313d22f6210f 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -928,16 +928,6 @@ pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return 0; } -#ifdef CONFIG_COMPAT -static long -pi433_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - return pi433_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); -} -#else -#define pi433_compat_ioctl NULL -#endif /* CONFIG_COMPAT */ - /*-------------------------------------------------------------------------*/ static int pi433_open(struct inode *inode, struct file *filp) @@ -1094,7 +1084,7 @@ static const struct file_operations pi433_fops = { .write = pi433_write, .read = pi433_read, .unlocked_ioctl = pi433_ioctl, - .compat_ioctl = pi433_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = pi433_open, .release = pi433_release, .llseek = no_llseek, diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 3f899552f6e3..646ffa13c1fc 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -2685,18 +2685,6 @@ static long usbdev_ioctl(struct file *file, unsigned int cmd, return ret; } -#ifdef CONFIG_COMPAT -static long usbdev_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int ret; - - ret = usbdev_do_ioctl(file, cmd, compat_ptr(arg)); - - return ret; -} -#endif - /* No kernel lock - fine */ static __poll_t usbdev_poll(struct file *file, struct poll_table_struct *wait) @@ -2720,9 +2708,7 @@ const struct file_operations usbdev_file_operations = { .read = usbdev_read, .poll = usbdev_poll, .unlocked_ioctl = usbdev_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = usbdev_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .mmap = usbdev_mmap, .open = usbdev_open, .release = usbdev_release, diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 388597930b64..c8482624ca34 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -1184,15 +1184,6 @@ static long vfio_fops_unl_ioctl(struct file *filep, return ret; } -#ifdef CONFIG_COMPAT -static long vfio_fops_compat_ioctl(struct file *filep, - unsigned int cmd, unsigned long arg) -{ - arg = (unsigned long)compat_ptr(arg); - return vfio_fops_unl_ioctl(filep, cmd, arg); -} -#endif /* CONFIG_COMPAT */ - static int vfio_fops_open(struct inode *inode, struct file *filep) { struct vfio_container *container; @@ -1275,9 +1266,7 @@ static const struct file_operations vfio_fops = { .read = vfio_fops_read, .write = vfio_fops_write, .unlocked_ioctl = vfio_fops_unl_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vfio_fops_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .mmap = vfio_fops_mmap, }; @@ -1556,15 +1545,6 @@ static long vfio_group_fops_unl_ioctl(struct file *filep, return ret; } -#ifdef CONFIG_COMPAT -static long vfio_group_fops_compat_ioctl(struct file *filep, - unsigned int cmd, unsigned long arg) -{ - arg = (unsigned long)compat_ptr(arg); - return vfio_group_fops_unl_ioctl(filep, cmd, arg); -} -#endif /* CONFIG_COMPAT */ - static int vfio_group_fops_open(struct inode *inode, struct file *filep) { struct vfio_group *group; @@ -1620,9 +1600,7 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep) static const struct file_operations vfio_group_fops = { .owner = THIS_MODULE, .unlocked_ioctl = vfio_group_fops_unl_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vfio_group_fops_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = vfio_group_fops_open, .release = vfio_group_fops_release, }; @@ -1687,24 +1665,13 @@ static int vfio_device_fops_mmap(struct file *filep, struct vm_area_struct *vma) return device->ops->mmap(device->device_data, vma); } -#ifdef CONFIG_COMPAT -static long vfio_device_fops_compat_ioctl(struct file *filep, - unsigned int cmd, unsigned long arg) -{ - arg = (unsigned long)compat_ptr(arg); - return vfio_device_fops_unl_ioctl(filep, cmd, arg); -} -#endif /* CONFIG_COMPAT */ - static const struct file_operations vfio_device_fops = { .owner = THIS_MODULE, .release = vfio_device_fops_release, .read = vfio_device_fops_read, .write = vfio_device_fops_write, .unlocked_ioctl = vfio_device_fops_unl_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vfio_device_fops_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .mmap = vfio_device_fops_mmap, }; diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 1a2dd53caade..e158159671fa 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1751,14 +1751,6 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, } } -#ifdef CONFIG_COMPAT -static long vhost_net_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vhost_net_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static ssize_t vhost_net_chr_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct file *file = iocb->ki_filp; @@ -1794,9 +1786,7 @@ static const struct file_operations vhost_net_fops = { .write_iter = vhost_net_chr_write_iter, .poll = vhost_net_chr_poll, .unlocked_ioctl = vhost_net_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vhost_net_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = vhost_net_open, .llseek = noop_llseek, }; diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index a9caf1bc3c3e..0b949a14bce3 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1727,21 +1727,11 @@ vhost_scsi_ioctl(struct file *f, } } -#ifdef CONFIG_COMPAT -static long vhost_scsi_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vhost_scsi_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations vhost_scsi_fops = { .owner = THIS_MODULE, .release = vhost_scsi_release, .unlocked_ioctl = vhost_scsi_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vhost_scsi_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = vhost_scsi_open, .llseek = noop_llseek, }; diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index 7804869c6a31..ec58a3330e5e 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -302,21 +302,11 @@ static long vhost_test_ioctl(struct file *f, unsigned int ioctl, } } -#ifdef CONFIG_COMPAT -static long vhost_test_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vhost_test_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations vhost_test_fops = { .owner = THIS_MODULE, .release = vhost_test_release, .unlocked_ioctl = vhost_test_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vhost_test_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = vhost_test_open, .llseek = noop_llseek, }; diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 9f57736fe15e..706c5e8e01ee 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -761,23 +761,13 @@ static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl, } } -#ifdef CONFIG_COMPAT -static long vhost_vsock_dev_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vhost_vsock_dev_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations vhost_vsock_fops = { .owner = THIS_MODULE, .open = vhost_vsock_dev_open, .release = vhost_vsock_dev_release, .llseek = noop_llseek, .unlocked_ioctl = vhost_vsock_dev_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vhost_vsock_dev_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice vhost_vsock_misc = { diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 401c17d36b71..811f45badc10 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1808,7 +1808,7 @@ const struct file_operations ceph_dir_fops = { .open = ceph_open, .release = ceph_release, .unlocked_ioctl = ceph_ioctl, - .compat_ioctl = ceph_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .fsync = ceph_fsync, .lock = ceph_lock, .flock = ceph_flock, diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 9e8e4bfe1d50..6092ccea50d2 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -2162,7 +2162,7 @@ const struct file_operations ceph_file_fops = { .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write, .unlocked_ioctl = ceph_ioctl, - .compat_ioctl = ceph_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .fallocate = ceph_fallocate, .copy_file_range = ceph_copy_file_range, }; diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 87bf9db76f98..10248cd71dd2 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1124,15 +1124,6 @@ extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl); /* ioctl.c */ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg); -static inline long -ceph_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ -#ifdef CONFIG_COMPAT - return ceph_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -#else - return -ENOTTY; -#endif -} /* export.c */ extern const struct export_operations ceph_export_ops; diff --git a/fs/fat/file.c b/fs/fat/file.c index 4614c0ba5f1c..bdc4503c00a3 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c @@ -172,15 +172,6 @@ long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } } -#ifdef CONFIG_COMPAT -static long fat_generic_compat_ioctl(struct file *filp, unsigned int cmd, - unsigned long arg) - -{ - return fat_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static int fat_file_release(struct inode *inode, struct file *filp) { if ((filp->f_mode & FMODE_WRITE) && @@ -215,9 +206,7 @@ const struct file_operations fat_file_operations = { .mmap = generic_file_mmap, .release = fat_file_release, .unlocked_ioctl = fat_generic_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = fat_generic_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .fsync = fat_file_fsync, .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write, From patchwork Wed Oct 9 19:10:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175650 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171712ill; Wed, 9 Oct 2019 12:12:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/jXLndR/GXAV/IrQYZdIuvr77/p9F8l2o4/A8wlT5WW0TagZBLseTJ7wuJFQQzFLvCw49 X-Received: by 2002:a05:6402:1252:: with SMTP id l18mr4478085edw.64.1570648333480; Wed, 09 Oct 2019 12:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648333; cv=none; d=google.com; s=arc-20160816; b=ntz3vFc/8OMNgYm7HtGMz7l/FgIVrr4eJQ8Nk6xMMDlgMpKQMgir4A2IzRHPBR+COP OQvX6ZlJDzOtPEcCuugBXd0yhVreTlQdd96dmW2uuGVyB5qrXNcn3SjlaA70yd6WQKcL DYug+u/5f1z0zZ4sfejzxyigOpXxYi+/yMPtPi3qTM72UEE5c1Gu7/w1lDZAcYARuFbA 4Xqm6RRh7GIALdnXZQuQZa/FlriHw/FpSk1CoiTQTrU7WNFPzDh6MtMfbMTzhbMMcSkW DZmCtAo74F2dfZi9DJMcry9Y/pkJVb7wUxgRCLMkEAoyAFM82ye/5xFCye6B7vkxnYZr tA9A== 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=2yAlx1/x886pHyUDJBfDck99NdrzLRWEH/5XlWnfbdg=; b=s2lmyFWOVt4ge3+ISZMVmfuZMHFZeKK4WkRxI8L/u0I0r5S56cysctjzVAH4UIIorS EOBPaqGBTFsWS2gk+F2/KcMzZXzICWQBfe9Ro+kMgkR74WWlcwBXSt5uXeXi3phqMimI FUwAWjcyZxyVTQv6qkeDmh563gQPJvdFsRq3S4rZWPSSyGTOrXFhMVG3uPTh9Z7yH0bD /aJw7gX/x2mfvkebztS6CHz263UD2tc+uPrWLcDVAjh2VRoeSZIPX8mHg1fwa9h1AqIs MEW31uMnKqQw3+4hbWB4sGKIOdeDH6vzCjAt32gzuw+WjPKsNZY4xaaUFEmVMfgeJQKD 0Nqw== 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 m1si1796997ejb.44.2019.10.09.12.12.13; Wed, 09 Oct 2019 12:12:13 -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 S1732272AbfJITMM (ORCPT + 26 others); Wed, 9 Oct 2019 15:12:12 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:41379 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731909AbfJITMK (ORCPT ); Wed, 9 Oct 2019 15:12:10 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M9WiK-1iClac1ot2-005Zyd; Wed, 09 Oct 2019 21:11:10 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Jason Gunthorpe , Daniel Vetter , Mauro Carvalho Chehab , Greg Kroah-Hartman , David Sterba , Darren Hart , Jonathan Cameron , Bjorn Andersson , Dan Williams Subject: [PATCH v6 12/43] compat_ioctl: move more drivers to compat_ptr_ioctl Date: Wed, 9 Oct 2019 21:10:12 +0200 Message-Id: <20191009191044.308087-12-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:m/6i5wT46mVkS5np72aX6YPC6vwimP9tyAJ3g7NP0hD/zBLPQHz hr84EpwlvKjdgj/jD/gdmAoiRv76mmUZvzpw4tpETR37tkTGExEfMCjfcF7koZv3EecBuoe ogHHi8yof9wQ7sFQHdOxSAgbg4clb00/c3Un1hqpulzUqj+jqpZV84lnO38Oj/KmqlyhoM+ o05a8cqPcD0o4XJJ43BMw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:9Bsv0YOoYw0=:rZ1oWU1n+hsHf6PpIOrbgy ajXztjkj8o+lASSN3mM5sOJ5AhrF66WC/eYdiWpB5JFgNhFMbFGt+IPye0vAf1AYoLE/HJNbk l0eJMi3aB6a2LOChhCSp7Ls6BJ7qf5cPeLR4y2PiznylWFmzkuFjrrnGQL/uye3HXATKOyICI 1AnD2XcJHNCjprgjWfttboJdhymKmk8oNkPzbK3PXzw4XDwEAOmFzTJCVcWCqyYF5aF+UgV8b SlzRgxcPFVRmO3JhEl/l2ldxRxNH2crmBwnZKxayuZglp6MH1bRuG+x7x9HMAhO7VQigJZmiR IWey44i0FJc2ktGZ5DjF9MZlt+uan6plHI6QsrOz0JcNB2nsO5N1krS1hWGYFnqq87zAa6v7e VFV86oEQIhvHpqNu/1ea8jtWQkbZRnM7fdud/QTnbvw/eNY7WXkT/HZvs9AzxFG+5pzvQm4Dm HzFvgk+24dcHbPdqOcc6QW+TesMjicoZABWxBaybRRltPukZjSTPjfaYaqnEswPz32gq9uYaF WEdUYM+o1rMDBSLzSo/bN49+HNV1CwBAfWyGUXNtU312latWBKQZQTM7NK+01F4E3BxYjZqak w04piPZOE0d3f+RD7Xkj6eGkFFGHvNTgCasFdI6+9g2OSAtCdvVuxNnwGATM8YTo7ymLUOdlZ 9hIAcv/Ztfb1AexnHyQomySQ3IEJk/fP3GHMGSLnnQz+I5hJSi8Os3mI5kR4hpdkQqy0AK0GM iqhxt55ky0SS23k84Cpfd1lSIRHTPC7H5Hn7duf+IDKkjex2Pv4VmkuFpd/p8yOpriV91PxAJ +rLjDEX+MzNZuZI4hBARwnYSwRjEWixsyxZHBZ/TT8HfuuO6lWTaGaTEqg/0wTaVngce7ogh/ YRDRguogXPVheRS5YO1Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The .ioctl and .compat_ioctl file operations have the same prototype so they can both point to the same function, which works great almost all the time when all the commands are compatible. One exception is the s390 architecture, where a compat pointer is only 31 bit wide, and converting it into a 64-bit pointer requires calling compat_ptr(). Most drivers here will never run in s390, but since we now have a generic helper for it, it's easy enough to use it consistently. I double-checked all these drivers to ensure that all ioctl arguments are used as pointers or are ignored, but are not interpreted as integer values. Acked-by: Jason Gunthorpe Acked-by: Daniel Vetter Acked-by: Mauro Carvalho Chehab Acked-by: Greg Kroah-Hartman Acked-by: David Sterba Acked-by: Darren Hart (VMware) Acked-by: Jonathan Cameron Acked-by: Bjorn Andersson Acked-by: Dan Williams Signed-off-by: Arnd Bergmann --- drivers/android/binder.c | 2 +- drivers/crypto/qat/qat_common/adf_ctl_drv.c | 2 +- drivers/dma-buf/dma-buf.c | 4 +--- drivers/dma-buf/sw_sync.c | 2 +- drivers/dma-buf/sync_file.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- drivers/hid/hidraw.c | 4 +--- drivers/iio/industrialio-core.c | 2 +- drivers/infiniband/core/uverbs_main.c | 4 ++-- drivers/media/rc/lirc_dev.c | 4 +--- drivers/misc/vmw_vmci/vmci_host.c | 2 +- drivers/nvdimm/bus.c | 4 ++-- drivers/nvme/host/core.c | 2 +- drivers/pci/switch/switchtec.c | 2 +- drivers/platform/x86/wmi.c | 2 +- drivers/rpmsg/rpmsg_char.c | 4 ++-- drivers/sbus/char/display7seg.c | 2 +- drivers/sbus/char/envctrl.c | 4 +--- drivers/scsi/3w-xxxx.c | 4 +--- drivers/scsi/cxlflash/main.c | 2 +- drivers/scsi/esas2r/esas2r_main.c | 2 +- drivers/scsi/pmcraid.c | 4 +--- drivers/staging/android/ion/ion.c | 4 +--- drivers/staging/vme/devices/vme_user.c | 2 +- drivers/tee/tee_core.c | 2 +- drivers/usb/class/cdc-wdm.c | 2 +- drivers/usb/class/usbtmc.c | 4 +--- drivers/virt/fsl_hypervisor.c | 2 +- fs/btrfs/super.c | 2 +- fs/fuse/dev.c | 2 +- fs/notify/fanotify/fanotify_user.c | 2 +- fs/userfaultfd.c | 2 +- net/rfkill/core.c | 2 +- 33 files changed, 36 insertions(+), 52 deletions(-) -- 2.20.0 diff --git a/drivers/android/binder.c b/drivers/android/binder.c index c0a491277aca..c7079f071e23 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -6063,7 +6063,7 @@ const struct file_operations binder_fops = { .owner = THIS_MODULE, .poll = binder_poll, .unlocked_ioctl = binder_ioctl, - .compat_ioctl = binder_ioctl, + .compat_ioctl = compat_ptr_ioctl, .mmap = binder_mmap, .open = binder_open, .flush = binder_flush, diff --git a/drivers/crypto/qat/qat_common/adf_ctl_drv.c b/drivers/crypto/qat/qat_common/adf_ctl_drv.c index abc7a7f64d64..ef0e482ee04f 100644 --- a/drivers/crypto/qat/qat_common/adf_ctl_drv.c +++ b/drivers/crypto/qat/qat_common/adf_ctl_drv.c @@ -68,7 +68,7 @@ static long adf_ctl_ioctl(struct file *fp, unsigned int cmd, unsigned long arg); static const struct file_operations adf_ctl_ops = { .owner = THIS_MODULE, .unlocked_ioctl = adf_ctl_ioctl, - .compat_ioctl = adf_ctl_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; struct adf_ctl_drv_info { diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 433d91d710e4..5b8797be80df 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -415,9 +415,7 @@ static const struct file_operations dma_buf_fops = { .llseek = dma_buf_llseek, .poll = dma_buf_poll, .unlocked_ioctl = dma_buf_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = dma_buf_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .show_fdinfo = dma_buf_show_fdinfo, }; diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c index 6713cfb1995c..348b3a9170fa 100644 --- a/drivers/dma-buf/sw_sync.c +++ b/drivers/dma-buf/sw_sync.c @@ -408,5 +408,5 @@ const struct file_operations sw_sync_debugfs_fops = { .open = sw_sync_debugfs_open, .release = sw_sync_debugfs_release, .unlocked_ioctl = sw_sync_ioctl, - .compat_ioctl = sw_sync_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c index 25c5c071645b..76fb072c22dc 100644 --- a/drivers/dma-buf/sync_file.c +++ b/drivers/dma-buf/sync_file.c @@ -480,5 +480,5 @@ static const struct file_operations sync_file_fops = { .release = sync_file_release, .poll = sync_file_poll, .unlocked_ioctl = sync_file_ioctl, - .compat_ioctl = sync_file_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 1d3cd5c50d5f..6283944387d6 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -49,7 +49,7 @@ static const char kfd_dev_name[] = "kfd"; static const struct file_operations kfd_fops = { .owner = THIS_MODULE, .unlocked_ioctl = kfd_ioctl, - .compat_ioctl = kfd_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = kfd_open, .mmap = kfd_mmap, }; diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index bbc6ec1aa5cb..a925f9fa7011 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -468,9 +468,7 @@ static const struct file_operations hidraw_ops = { .release = hidraw_release, .unlocked_ioctl = hidraw_ioctl, .fasync = hidraw_fasync, -#ifdef CONFIG_COMPAT - .compat_ioctl = hidraw_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 524a686077ca..9dd687534035 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -1610,7 +1610,7 @@ static const struct file_operations iio_buffer_fileops = { .owner = THIS_MODULE, .llseek = noop_llseek, .unlocked_ioctl = iio_ioctl, - .compat_ioctl = iio_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static int iio_check_unique_scan_index(struct iio_dev *indio_dev) diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index db98111b47f4..c4c652e87044 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c @@ -1139,7 +1139,7 @@ static const struct file_operations uverbs_fops = { .release = ib_uverbs_close, .llseek = no_llseek, .unlocked_ioctl = ib_uverbs_ioctl, - .compat_ioctl = ib_uverbs_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static const struct file_operations uverbs_mmap_fops = { @@ -1150,7 +1150,7 @@ static const struct file_operations uverbs_mmap_fops = { .release = ib_uverbs_close, .llseek = no_llseek, .unlocked_ioctl = ib_uverbs_ioctl, - .compat_ioctl = ib_uverbs_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static int ib_uverbs_get_nl_info(struct ib_device *ibdev, void *client_data, diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index f078f8a3aec8..9a8c1cf54ac4 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -720,9 +720,7 @@ static const struct file_operations lirc_fops = { .owner = THIS_MODULE, .write = ir_lirc_transmit_ir, .unlocked_ioctl = ir_lirc_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = ir_lirc_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .read = ir_lirc_read, .poll = ir_lirc_poll, .open = ir_lirc_open, diff --git a/drivers/misc/vmw_vmci/vmci_host.c b/drivers/misc/vmw_vmci/vmci_host.c index 833e2bd248a5..903e321e8e87 100644 --- a/drivers/misc/vmw_vmci/vmci_host.c +++ b/drivers/misc/vmw_vmci/vmci_host.c @@ -961,7 +961,7 @@ static const struct file_operations vmuser_fops = { .release = vmci_host_close, .poll = vmci_host_poll, .unlocked_ioctl = vmci_host_unlocked_ioctl, - .compat_ioctl = vmci_host_unlocked_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice vmci_host_miscdev = { diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index d47412dcdf38..38d41bbf178a 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -1227,7 +1227,7 @@ static const struct file_operations nvdimm_bus_fops = { .owner = THIS_MODULE, .open = nd_open, .unlocked_ioctl = bus_ioctl, - .compat_ioctl = bus_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; @@ -1235,7 +1235,7 @@ static const struct file_operations nvdimm_fops = { .owner = THIS_MODULE, .open = nd_open, .unlocked_ioctl = dimm_ioctl, - .compat_ioctl = dimm_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index fd7dea36c3b6..522280eb4115 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2947,7 +2947,7 @@ static const struct file_operations nvme_dev_fops = { .owner = THIS_MODULE, .open = nvme_dev_open, .unlocked_ioctl = nvme_dev_ioctl, - .compat_ioctl = nvme_dev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static ssize_t nvme_sysfs_reset(struct device *dev, diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index 8c94cd3fd1f2..66610f04d76d 100644 --- a/drivers/pci/switch/switchtec.c +++ b/drivers/pci/switch/switchtec.c @@ -1025,7 +1025,7 @@ static const struct file_operations switchtec_fops = { .read = switchtec_dev_read, .poll = switchtec_dev_poll, .unlocked_ioctl = switchtec_dev_ioctl, - .compat_ioctl = switchtec_dev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static void link_event_work(struct work_struct *work) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 59e9aa0f9643..dc2e966a5c25 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -911,7 +911,7 @@ static const struct file_operations wmi_fops = { .read = wmi_char_read, .open = wmi_char_open, .unlocked_ioctl = wmi_ioctl, - .compat_ioctl = wmi_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static int wmi_dev_probe(struct device *dev) diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index eea5ebbb5119..507bfe163883 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -290,7 +290,7 @@ static const struct file_operations rpmsg_eptdev_fops = { .write_iter = rpmsg_eptdev_write_iter, .poll = rpmsg_eptdev_poll, .unlocked_ioctl = rpmsg_eptdev_ioctl, - .compat_ioctl = rpmsg_eptdev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static ssize_t name_show(struct device *dev, struct device_attribute *attr, @@ -451,7 +451,7 @@ static const struct file_operations rpmsg_ctrldev_fops = { .open = rpmsg_ctrldev_open, .release = rpmsg_ctrldev_release, .unlocked_ioctl = rpmsg_ctrldev_ioctl, - .compat_ioctl = rpmsg_ctrldev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static void rpmsg_ctrldev_release_device(struct device *dev) diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index 971fe074d7c9..fad936eb845f 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c @@ -156,7 +156,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static const struct file_operations d7s_fops = { .owner = THIS_MODULE, .unlocked_ioctl = d7s_ioctl, - .compat_ioctl = d7s_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = d7s_open, .release = d7s_release, .llseek = noop_llseek, diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c index a63d5e402ff2..12d66aa61ede 100644 --- a/drivers/sbus/char/envctrl.c +++ b/drivers/sbus/char/envctrl.c @@ -715,9 +715,7 @@ static const struct file_operations envctrl_fops = { .owner = THIS_MODULE, .read = envctrl_read, .unlocked_ioctl = envctrl_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = envctrl_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = envctrl_open, .release = envctrl_release, .llseek = noop_llseek, diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 2b1e0d503020..fb6444d0409c 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -1049,9 +1049,7 @@ static int tw_chrdev_open(struct inode *inode, struct file *file) static const struct file_operations tw_fops = { .owner = THIS_MODULE, .unlocked_ioctl = tw_chrdev_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = tw_chrdev_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = tw_chrdev_open, .release = NULL, .llseek = noop_llseek, diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 93ef97af22df..2dbf35f82787 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -3593,7 +3593,7 @@ static const struct file_operations cxlflash_chr_fops = { .owner = THIS_MODULE, .open = cxlflash_chr_open, .unlocked_ioctl = cxlflash_chr_ioctl, - .compat_ioctl = cxlflash_chr_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; /** diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c index fdbda5c05aa0..80c5a235d193 100644 --- a/drivers/scsi/esas2r/esas2r_main.c +++ b/drivers/scsi/esas2r/esas2r_main.c @@ -613,7 +613,7 @@ static int __init esas2r_init(void) /* Handle ioctl calls to "/proc/scsi/esas2r/ATTOnode" */ static const struct file_operations esas2r_proc_fops = { - .compat_ioctl = esas2r_proc_ioctl, + .compat_ioctl = compat_ptr_ioctl, .unlocked_ioctl = esas2r_proc_ioctl, }; diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 398d2af60832..7eb88fe1eb0b 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -3973,9 +3973,7 @@ static const struct file_operations pmcraid_fops = { .open = pmcraid_chr_open, .fasync = pmcraid_chr_fasync, .unlocked_ioctl = pmcraid_chr_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = pmcraid_chr_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index e6b1ca141b93..c394686a8e7d 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -533,9 +533,7 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) static const struct file_operations ion_fops = { .owner = THIS_MODULE, .unlocked_ioctl = ion_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = ion_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; static int debug_shrink_set(void *data, u64 val) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 6a33aaa1a49f..fd0ea4dbcb91 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -494,7 +494,7 @@ static const struct file_operations vme_user_fops = { .write = vme_user_write, .llseek = vme_user_llseek, .unlocked_ioctl = vme_user_unlocked_ioctl, - .compat_ioctl = vme_user_unlocked_ioctl, + .compat_ioctl = compat_ptr_ioctl, .mmap = vme_user_mmap, }; diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 0f16d9ffd8d1..37d22e39fd8d 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -675,7 +675,7 @@ static const struct file_operations tee_fops = { .open = tee_open, .release = tee_release, .unlocked_ioctl = tee_ioctl, - .compat_ioctl = tee_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static void tee_release_device(struct device *dev) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 70afb2ca1eab..e3db6fbeadef 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -734,7 +734,7 @@ static const struct file_operations wdm_fops = { .release = wdm_release, .poll = wdm_poll, .unlocked_ioctl = wdm_ioctl, - .compat_ioctl = wdm_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index dcd7066ffba2..ffc9c6fdd7e1 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c @@ -2217,9 +2217,7 @@ static const struct file_operations fops = { .release = usbtmc_release, .flush = usbtmc_flush, .unlocked_ioctl = usbtmc_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = usbtmc_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .fasync = usbtmc_fasync, .poll = usbtmc_poll, .llseek = default_llseek, diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c index 93d5bebf9572..1b0b11b55d2a 100644 --- a/drivers/virt/fsl_hypervisor.c +++ b/drivers/virt/fsl_hypervisor.c @@ -706,7 +706,7 @@ static const struct file_operations fsl_hv_fops = { .poll = fsl_hv_poll, .read = fsl_hv_read, .unlocked_ioctl = fsl_hv_ioctl, - .compat_ioctl = fsl_hv_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice fsl_hv_misc_dev = { diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 1b151af25772..d9ba089a4973 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2297,7 +2297,7 @@ static const struct super_operations btrfs_super_ops = { static const struct file_operations btrfs_ctl_fops = { .open = btrfs_control_open, .unlocked_ioctl = btrfs_control_ioctl, - .compat_ioctl = btrfs_control_ioctl, + .compat_ioctl = compat_ptr_ioctl, .owner = THIS_MODULE, .llseek = noop_llseek, }; diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index dadd617d826c..23b089e6880a 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2260,7 +2260,7 @@ const struct file_operations fuse_dev_operations = { .release = fuse_dev_release, .fasync = fuse_dev_fasync, .unlocked_ioctl = fuse_dev_ioctl, - .compat_ioctl = fuse_dev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; EXPORT_SYMBOL_GPL(fuse_dev_operations); diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 8508ab575017..0aa362b88550 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -523,7 +523,7 @@ static const struct file_operations fanotify_fops = { .fasync = NULL, .release = fanotify_release, .unlocked_ioctl = fanotify_ioctl, - .compat_ioctl = fanotify_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index f9fd18670e22..d7f54e535294 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -1923,7 +1923,7 @@ static const struct file_operations userfaultfd_fops = { .poll = userfaultfd_poll, .read = userfaultfd_read, .unlocked_ioctl = userfaultfd_ioctl, - .compat_ioctl = userfaultfd_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/net/rfkill/core.c b/net/rfkill/core.c index f9b08a6d8dbe..c4be6a94ba97 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -1311,7 +1311,7 @@ static const struct file_operations rfkill_fops = { .release = rfkill_fop_release, #ifdef CONFIG_RFKILL_INPUT .unlocked_ioctl = rfkill_fop_ioctl, - .compat_ioctl = rfkill_fop_ioctl, + .compat_ioctl = compat_ptr_ioctl, #endif .llseek = no_llseek, }; From patchwork Wed Oct 9 19:10:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175662 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1173692ill; Wed, 9 Oct 2019 12:13:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUCoZtfGGu5vVGxsLiUQIiONeSWHXBrbvcHvf8Fnv1guOWAc9aeCd/F7WR1AzdQ2YAgjb6 X-Received: by 2002:a17:907:2095:: with SMTP id pv21mr4166628ejb.324.1570648433790; Wed, 09 Oct 2019 12:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648433; cv=none; d=google.com; s=arc-20160816; b=p/IPLzhbh+h6rOKz2uiFpPv4md35SrbIJX59DODjTOI/66HfL+GyJWEoRtsu3NThKp RRRG57ht9AHf11rQQe+ZFIvH4xalhv4E9cqzAdX+CiVzYg0Tsw6whdXRUq21vfoAq9id DtFmS+AWnJKevekkLi7EaMUf4qRHDTkrhQwU1l6VOJUDTRyZg9d3dgW3r+h0F6t2s3LV EnJ3DOwAgplP6Lw6BF4uGu2HnPlZbXnWqCw2ZndYWIIGyu6md/QWfNRnpa8SWZju585o PHwRte0bo+HfFLnWuQErKjjuc7A2xcvBmcNw/fskvZ8iG2PxoiFqx+QTR679JEcHIlLa AtbA== 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=NDgSSP89w95Fk48g2kpjYBRcXVjF+nIkmW7K5oEy0j8=; b=dpO5FhP0eJROhmw5AQUjVU0Pm/+66NSpKos9uf75/lR68H44HATTHdDf2zrftq007z gJ5/GZhlHZWMiq4eJsc5rrmaIDGLPVNv7oUtUosz8qgQvBOcmVaPSVYfOnS+ONkxXERK VPZqUqCk3b73tUiVnqUaSB2uvwUAjzDkdz3l+eR5rRViCkdFlqgkFSEOij5f8W5uJJdR aqYaZti/jGZ3w0spIAG0Xy+KS9Q6V31pKGu7FaCDfChPu+RfYtWDYjfxKZzcX/rB9DpQ 2xVA/ijhgIe+MikOv3IoL2UdBPe16RGClhjf15F1FLhNwdpJ8ihNExhweorMqVfAfklY u5bA== 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 g7si1764116ejd.78.2019.10.09.12.13.53; Wed, 09 Oct 2019 12:13:53 -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 S1732471AbfJITNw (ORCPT + 26 others); Wed, 9 Oct 2019 15:13:52 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:51095 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731922AbfJITLU (ORCPT ); Wed, 9 Oct 2019 15:11:20 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MXXdn-1iajhJ3863-00YxNA; Wed, 09 Oct 2019 21:11:10 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , Andrew Donnellan , Felipe Balbi Subject: [PATCH v6 13/43] compat_ioctl: use correct compat_ptr() translation in drivers Date: Wed, 9 Oct 2019 21:10:13 +0200 Message-Id: <20191009191044.308087-13-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:2Ri+AmqHP2IgSyuBrP8IXouAO/GywqDxk3Oop8VJyII1VjvrXgG g9gF3z2VGIP5Ci2S3stEsEM2C9eWsVyZmsGxAiDAfzJw7LKUcEYJOFbJRXQkXmcdsOMKvw9 fORHBgakc1Gdv3KXkP8MUEYgTFVmyg5fHUUjBj/mYAHfrWwOIE/hUagBclbnVofe8zyZPa+ CH0sYmDNlNMuFz+vaBFhg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:2NQGECvoGC4=:S58aRpaPBAOZ8FNVwSW1SG 50dLXpGb+RJ5ycryuKaEPzaJ1PXl9S/CSYXP7wskUMoL5TZTX90q6pTa0t/7dUQRPTcR3KGQv Zyp8IomcQKdRb1MXkib3kFg+OsuNBdJE3XNbg2F6XdrfvZtvoo54Wo8J3uQzc4NdkeHoA1IKk 9+aNqCP6mRUcOu4v+6xkZK493jV1ag1oywXC5C+DDpT/hA1SQEm8zi9PLsvLSAfWgs+0FnzQ2 dOdiy/L9Azg57TodxpwlT0k0OdGDx+Hu2NTmeYGzKE3RC3zw6BDs6NvU5LbLY6O7CZrMqbUoG vjTMTPty4v2H+kFxYR+4iM6V8TR5BedxaMMWtM3BNfBzGLWklJ5Z7p8vaQw3k+q6fDEUHrHIg 2xx3aNmLyQJPK/VT4DTujtqiqNaKl1nUEIae/axjp+Xx/jNI1nrKLqd0C/gu+igGT8NFXuJ5O iz3Yh6E1xlkPhdBcvwviyh6ExMfef9Q3fFcT1gurQlJbOiOQUiTPY4dUbfNSzSq84vMFYhFqB 0zFWpev0UXhtamltB3ITKlXky5E0xj2JMhvdm7Rrux71FRQSIGkpLNNSYhl8qSWdCZco7TDbb d4vnw3oUL4UTXPOJhQxB4IiwB4srl8Kn+eDSCAkyWHgGlGebIc4fQUR05mHqI9K3knM9xc17K onwIUjw6wnOdCIZWLeYI4X0jBotHQ6ayJ+w4+zt0o5bHDF0doVwq/BV5pCa3QCANq43sTm2+Z YJRM4LWvZ7WC2QFFFAmEudb2J3yOCZ3d4RhR72YT57dPqbHZVsMhD1tqMYzLTF9YPyvB8c5BV Jsk0u6lFgMhckIw48ZYmnchOh82+4BgBWm0snIHhbyUUYgNzs+oOoEZY5NT/hkgSJ8tTiDENu N7NoF0vA3e3mY2dhv16A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A handful of drivers all have a trivial wrapper around their ioctl handler, but don't call the compat_ptr() conversion function at the moment. In practice this does not matter, since none of them are used on the s390 architecture and for all other architectures, compat_ptr() does not do anything, but using the new compat_ptr_ioctl() helper makes it more correct in theory, and simplifies the code. I checked that all ioctl handlers in these files are compatible and take either pointer arguments or no argument. Acked-by: Al Viro Acked-by: Greg Kroah-Hartman Acked-by: Andrew Donnellan Acked-by: Felipe Balbi Signed-off-by: Arnd Bergmann --- drivers/misc/cxl/flash.c | 8 +------- drivers/misc/genwqe/card_dev.c | 23 +---------------------- drivers/scsi/megaraid/megaraid_mm.c | 28 +--------------------------- drivers/usb/gadget/function/f_fs.c | 12 +----------- 4 files changed, 4 insertions(+), 67 deletions(-) -- 2.20.0 diff --git a/drivers/misc/cxl/flash.c b/drivers/misc/cxl/flash.c index 4d6836f19489..cb9cca35a226 100644 --- a/drivers/misc/cxl/flash.c +++ b/drivers/misc/cxl/flash.c @@ -473,12 +473,6 @@ static long device_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return -EINVAL; } -static long device_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - return device_ioctl(file, cmd, arg); -} - static int device_close(struct inode *inode, struct file *file) { struct cxl *adapter = file->private_data; @@ -514,7 +508,7 @@ static const struct file_operations fops = { .owner = THIS_MODULE, .open = device_open, .unlocked_ioctl = device_ioctl, - .compat_ioctl = device_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .release = device_close, }; diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 0e34c0568fed..040a0bda3125 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c @@ -1215,34 +1215,13 @@ static long genwqe_ioctl(struct file *filp, unsigned int cmd, return rc; } -#if defined(CONFIG_COMPAT) -/** - * genwqe_compat_ioctl() - Compatibility ioctl - * - * Called whenever a 32-bit process running under a 64-bit kernel - * performs an ioctl on /dev/genwqe_card. - * - * @filp: file pointer. - * @cmd: command. - * @arg: user argument. - * Return: zero on success or negative number on failure. - */ -static long genwqe_compat_ioctl(struct file *filp, unsigned int cmd, - unsigned long arg) -{ - return genwqe_ioctl(filp, cmd, arg); -} -#endif /* defined(CONFIG_COMPAT) */ - static const struct file_operations genwqe_fops = { .owner = THIS_MODULE, .open = genwqe_open, .fasync = genwqe_fasync, .mmap = genwqe_mmap, .unlocked_ioctl = genwqe_ioctl, -#if defined(CONFIG_COMPAT) - .compat_ioctl = genwqe_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .release = genwqe_release, }; diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index 59cca898f088..e83163c66884 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c @@ -41,10 +41,6 @@ static int mraid_mm_setup_dma_pools(mraid_mmadp_t *); static void mraid_mm_free_adp_resources(mraid_mmadp_t *); static void mraid_mm_teardown_dma_pools(mraid_mmadp_t *); -#ifdef CONFIG_COMPAT -static long mraid_mm_compat_ioctl(struct file *, unsigned int, unsigned long); -#endif - MODULE_AUTHOR("LSI Logic Corporation"); MODULE_DESCRIPTION("LSI Logic Management Module"); MODULE_LICENSE("GPL"); @@ -68,9 +64,7 @@ static wait_queue_head_t wait_q; static const struct file_operations lsi_fops = { .open = mraid_mm_open, .unlocked_ioctl = mraid_mm_unlocked_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = mraid_mm_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .owner = THIS_MODULE, .llseek = noop_llseek, }; @@ -224,7 +218,6 @@ mraid_mm_unlocked_ioctl(struct file *filep, unsigned int cmd, { int err; - /* inconsistent: mraid_mm_compat_ioctl doesn't take the BKL */ mutex_lock(&mraid_mm_mutex); err = mraid_mm_ioctl(filep, cmd, arg); mutex_unlock(&mraid_mm_mutex); @@ -1228,25 +1221,6 @@ mraid_mm_init(void) } -#ifdef CONFIG_COMPAT -/** - * mraid_mm_compat_ioctl - 32bit to 64bit ioctl conversion routine - * @filep : file operations pointer (ignored) - * @cmd : ioctl command - * @arg : user ioctl packet - */ -static long -mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd, - unsigned long arg) -{ - int err; - - err = mraid_mm_ioctl(filep, cmd, arg); - - return err; -} -#endif - /** * mraid_mm_exit - Module exit point */ diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 59d9d512dcda..ce1d0235969c 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1352,14 +1352,6 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, return ret; } -#ifdef CONFIG_COMPAT -static long ffs_epfile_compat_ioctl(struct file *file, unsigned code, - unsigned long value) -{ - return ffs_epfile_ioctl(file, code, value); -} -#endif - static const struct file_operations ffs_epfile_operations = { .llseek = no_llseek, @@ -1368,9 +1360,7 @@ static const struct file_operations ffs_epfile_operations = { .read_iter = ffs_epfile_read_iter, .release = ffs_epfile_release, .unlocked_ioctl = ffs_epfile_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = ffs_epfile_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; From patchwork Wed Oct 9 19:10:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175659 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1173347ill; Wed, 9 Oct 2019 12:13:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoHSCeNkZsHynBBU9F18rsBjzRtMntpq3crA1K70C/X1R+tT8ajpZkzRGqrhwCstYOF+VW X-Received: by 2002:a17:906:130c:: with SMTP id w12mr4269148ejb.142.1570648414582; Wed, 09 Oct 2019 12:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648414; cv=none; d=google.com; s=arc-20160816; b=XyWGkJSffFFloTU22MCqA6X++Oc7yOvYGboKab8bx2Jz04dDw2EytYQYSKXzvsxwhS 8Z5ffEco8vI5rIG/Tj6aWGOnUoFF9SBC/DMiXhANGyuMZNMf+pQD1wh8vrRayS2iq8Ps aJ9QIxugMZIpYj9mMKtXixX5GHGri9mI4mD4wNID4qKCPUy9WAj82rc4edhmqmBvS0ID r5uL775NK3SLZpAAy8m6L90PrNK0VuQClnk0w9ouiZavPqq3UC67jvRoQ7wpT/Tp+maF 73hHzRu11CWik0wsjQzN4bspIez0uEnBxCFD0ToseI0dp+1CbhnSAjqNJp0zDNGM3653 GLbw== 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=ud0kiqRYORTDRkkY/cJj6eHLLNM0ag1GWDOKOCu21hY=; b=UUN/GWBptg/T0GhH0MHfSoxnfOanq4EG1GaYkLo2OJiD4GaBCHrUZ0i71HJsY7vp+v Avj6CtVKrqInBihJqQX2erzUtedgrWjun1/frDAuV0yW1aor8tG8qbZ3bHMA/zT8uRP6 Iak4+LfByhVshK8fkuJD67XNFncM99puYDlevTWALSpwi0yNzONsYBBRiHz2maTJr/0S uNH8dJ8MIXB87dGmJIy7FitDzak4wpQi/t80Sc4uQzjvW+duVEwneFgCAk8AnFQgVAOf PIg6EjrkaH58yddqS1aN03YCroB5lehZjO5GnakDjtJgggMwEuztdKTiLuswQzTERrCK v5Xg== 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 v22si1750475edq.239.2019.10.09.12.13.34; Wed, 09 Oct 2019 12:13:34 -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 S1732441AbfJITNd (ORCPT + 26 others); Wed, 9 Oct 2019 15:13:33 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:49065 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731976AbfJITLY (ORCPT ); Wed, 9 Oct 2019 15:11:24 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MJmX3-1iY1zi19LN-00K63S; Wed, 09 Oct 2019 21:11:11 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Heiko Carstens , =?utf-8?q?Kai_M=C3=A4kisara?= , linux-scsi@vger.kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" , "David S. Miller" Subject: [PATCH v6 14/43] compat_ioctl: move tape handling into drivers Date: Wed, 9 Oct 2019 21:10:14 +0200 Message-Id: <20191009191044.308087-14-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:dX6EYr/e+tXqH/3i7CUAu5i2JPBoHn6xZkuxBVVBRC86zLcXHtN AP9fh28WHIAve+RkZd6GTnNfeagwgbIuBqZRS2GCuPLWhBKEHQhffYZ/nmlN6jdHVZp9dUI rnM2FTUttKIgSQiQbHnu8o8IZMrWxPb0aZZOPkvcC5umqHzWHX/8PsnSMSDTtLw/hQqn03N +zpOJI7Mv7FQGjZZyBDlg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:qO/OYT39+Po=:/BAoFq03WGJOzNLnxE4e/x 7052GJzjVUJsihh8IW0rb9qaJP3ZyZnfEgygA7Wp8CmW7Fa5fgFB9UqQBf7JqGTsN/SHazJZL Bhix6nfoTuOLYdGEVxQotGFtlaAf1zHLTz6U2f0s+ApSsaqj1glgBpc0X7dOHdv/96Tbm0Guq wmS9Mo1vAgwGdTIzkDmZLC4iWE1lovohjzGJ8RJLi0B1QEzAfeQQMortreXNCJdAIrkZ+xF3s rNV8B46A/D5rE7Ye4lxrc6Cgev5roPjoQ3G+SZR9C/d+n+Xka5SMo4pOADTgEh3U67pHpMkY/ dDST9zqLkh5F1R6P7GsdWA7f3fYN4rgsVp90GaeKBv72ox6hFpPR/iF780kFbrmbIJ6a0BtRi gT4/nXc5MqALaCNZKSiYC3kGloe36XjPJp70ErjN50X//EX6+ymGZbKwnb7aMy3lSQERim3pa TUn/tK5p1JpAR5q1XFDDpGIvi5mfdRtrnlswBH+IvA51hVgiACpYVJd7K72gKa2k4ocbPzdFe VZpLF9ZpMqzcUmn56xcKi2wk9flbnGDDf4/mn67Dw4BKu5VeB9igFhB4bzHL8jTdmgD6K2ETn mYgRaZ+q44n7wIOoX37gU56Fzw8Lm61Ar9/oX/Szz5tSH/jApNBV+AeeJYPaagdnuo6pB6IS/ HRAvLTRHyfdFhl1MoCMkKPvYaEtyCJGnpxbfWZp8DutFc/1ku6wmbirlEYmpAgF829hyS9/1A Zi3rsWbxRRKJp8J2Nz49yELVOch06kzjs5ecV0FkpbodZ2caLCImdWJlUhmTUDgNSbg7c76fi NLSlavAzdXadAjt5VydWU1UaYUndDZF/Vh7JNPeS4EzLIOjUuNru8e6Zq5BZUycCmCfSt8/cw hGxflgnmorzw0/YxUs9V46hGAXsKCxIdgH3z/sN9n2SSwVyjxAYOecJPbruQzepBgAJbkuqn5 LV8LfvvcfnDT3O4nAXVeXxA8fRVu3kf8= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MTIOCPOS and MTIOCGET are incompatible between 32-bit and 64-bit user space, and traditionally have been translated in fs/compat_ioctl.c. To get rid of that translation handler, move a corresponding implementation into each of the four drivers implementing those commands. The interesting part of that is now in a new linux/mtio.h header that wraps the existing uapi/linux/mtio.h header and provides an abstraction to let drivers handle both cases easily. Using an in_compat_syscall() check, the caller does not have to keep track of whether this was called through .unlocked_ioctl() or .compat_ioctl(). Acked-by: Heiko Carstens Cc: "Kai Mäkisara" Cc: linux-scsi@vger.kernel.org Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: "David S. Miller" Signed-off-by: Arnd Bergmann --- drivers/ide/ide-tape.c | 27 ++++++++++--- drivers/s390/char/tape_char.c | 41 +++++++------------- drivers/scsi/st.c | 28 +++++++++----- fs/compat_ioctl.c | 73 ----------------------------------- include/linux/mtio.h | 60 ++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+), 115 deletions(-) create mode 100644 include/linux/mtio.h -- 2.20.0 diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index db1a65f4b490..3e7482695f77 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -19,6 +19,7 @@ #define IDETAPE_VERSION "1.20" +#include #include #include #include @@ -1407,14 +1408,10 @@ static long do_idetape_chrdev_ioctl(struct file *file, if (tape->drv_write_prot) mtget.mt_gstat |= GMT_WR_PROT(0xffffffff); - if (copy_to_user(argp, &mtget, sizeof(struct mtget))) - return -EFAULT; - return 0; + return put_user_mtget(argp, &mtget); case MTIOCPOS: mtpos.mt_blkno = position / tape->user_bs_factor - block_offset; - if (copy_to_user(argp, &mtpos, sizeof(struct mtpos))) - return -EFAULT; - return 0; + return put_user_mtpos(argp, &mtpos); default: if (tape->chrdev_dir == IDETAPE_DIR_READ) ide_tape_discard_merge_buffer(drive, 1); @@ -1432,6 +1429,22 @@ static long idetape_chrdev_ioctl(struct file *file, return ret; } +static long idetape_chrdev_compat_ioctl(struct file *file, + unsigned int cmd, unsigned long arg) +{ + long ret; + + if (cmd == MTIOCPOS32) + cmd = MTIOCPOS; + else if (cmd == MTIOCGET32) + cmd = MTIOCGET; + + mutex_lock(&ide_tape_mutex); + ret = do_idetape_chrdev_ioctl(file, cmd, arg); + mutex_unlock(&ide_tape_mutex); + return ret; +} + /* * Do a mode sense page 0 with block descriptor and if it succeeds set the tape * block size with the reported value. @@ -1886,6 +1899,8 @@ static const struct file_operations idetape_fops = { .read = idetape_chrdev_read, .write = idetape_chrdev_write, .unlocked_ioctl = idetape_chrdev_ioctl, + .compat_ioctl = IS_ENABLED(CONFIG_COMPAT) ? + idetape_chrdev_compat_ioctl : NULL, .open = idetape_chrdev_open, .release = idetape_chrdev_release, .llseek = noop_llseek, diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index ea4253939555..8abb42923307 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c @@ -341,14 +341,14 @@ tapechar_release(struct inode *inode, struct file *filp) */ static int __tapechar_ioctl(struct tape_device *device, - unsigned int no, unsigned long data) + unsigned int no, void __user *data) { int rc; if (no == MTIOCTOP) { struct mtop op; - if (copy_from_user(&op, (char __user *) data, sizeof(op)) != 0) + if (copy_from_user(&op, data, sizeof(op)) != 0) return -EFAULT; if (op.mt_count < 0) return -EINVAL; @@ -392,9 +392,7 @@ __tapechar_ioctl(struct tape_device *device, if (rc < 0) return rc; pos.mt_blkno = rc; - if (copy_to_user((char __user *) data, &pos, sizeof(pos)) != 0) - return -EFAULT; - return 0; + return put_user_mtpos(data, &pos); } if (no == MTIOCGET) { /* MTIOCGET: query the tape drive status. */ @@ -424,15 +422,12 @@ __tapechar_ioctl(struct tape_device *device, get.mt_blkno = rc; } - if (copy_to_user((char __user *) data, &get, sizeof(get)) != 0) - return -EFAULT; - - return 0; + return put_user_mtget(data, &get); } /* Try the discipline ioctl function. */ if (device->discipline->ioctl_fn == NULL) return -EINVAL; - return device->discipline->ioctl_fn(device, no, data); + return device->discipline->ioctl_fn(device, no, (unsigned long)data); } static long @@ -445,7 +440,7 @@ tapechar_ioctl(struct file *filp, unsigned int no, unsigned long data) device = (struct tape_device *) filp->private_data; mutex_lock(&device->mutex); - rc = __tapechar_ioctl(device, no, data); + rc = __tapechar_ioctl(device, no, (void __user *)data); mutex_unlock(&device->mutex); return rc; } @@ -455,23 +450,17 @@ static long tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data) { struct tape_device *device = filp->private_data; - int rval = -ENOIOCTLCMD; - unsigned long argp; + long rc; - /* The 'arg' argument of any ioctl function may only be used for - * pointers because of the compat pointer conversion. - * Consider this when adding new ioctls. - */ - argp = (unsigned long) compat_ptr(data); - if (device->discipline->ioctl_fn) { - mutex_lock(&device->mutex); - rval = device->discipline->ioctl_fn(device, no, argp); - mutex_unlock(&device->mutex); - if (rval == -EINVAL) - rval = -ENOIOCTLCMD; - } + if (no == MTIOCPOS32) + no = MTIOCPOS; + else if (no == MTIOCGET32) + no = MTIOCGET; - return rval; + mutex_lock(&device->mutex); + rc = __tapechar_ioctl(device, no, compat_ptr(data)); + mutex_unlock(&device->mutex); + return rc; } #endif /* CONFIG_COMPAT */ diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index e3266a64a477..9e3fff2de83e 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -22,6 +22,7 @@ static const char *verstr = "20160209"; #include +#include #include #include #include @@ -3800,14 +3801,11 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) if (STp->cleaning_req) mt_status.mt_gstat |= GMT_CLN(0xffffffff); - i = copy_to_user(p, &mt_status, sizeof(struct mtget)); - if (i) { - retval = (-EFAULT); + retval = put_user_mtget(p, &mt_status); + if (retval) goto out; - } STp->recover_reg = 0; /* Clear after read */ - retval = 0; goto out; } /* End of MTIOCGET */ if (cmd_type == _IOC_TYPE(MTIOCPOS) && cmd_nr == _IOC_NR(MTIOCPOS)) { @@ -3821,9 +3819,7 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) goto out; } mt_pos.mt_blkno = blk; - i = copy_to_user(p, &mt_pos, sizeof(struct mtpos)); - if (i) - retval = (-EFAULT); + retval = put_user_mtpos(p, &mt_pos); goto out; } mutex_unlock(&STp->lock); @@ -3857,14 +3853,26 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) } #ifdef CONFIG_COMPAT -static long st_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +static long st_compat_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) { + void __user *p = compat_ptr(arg); struct scsi_tape *STp = file->private_data; struct scsi_device *sdev = STp->device; int ret = -ENOIOCTLCMD; + + /* argument conversion is handled using put_user_mtpos/put_user_mtget */ + switch (cmd_in) { + case MTIOCTOP: + return st_ioctl(file, MTIOCTOP, (unsigned long)p); + case MTIOCPOS32: + return st_ioctl(file, MTIOCPOS, (unsigned long)p); + case MTIOCGET32: + return st_ioctl(file, MTIOCGET, (unsigned long)p); + } + if (sdev->host->hostt->compat_ioctl) { - ret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); + ret = sdev->host->hostt->compat_ioctl(sdev, cmd_in, (void __user *)arg); } return ret; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 47da220f95b1..b65eef3d4787 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -361,73 +360,6 @@ static int ppp_scompress(struct file *file, unsigned int cmd, return do_ioctl(file, PPPIOCSCOMPRESS, (unsigned long) odata); } -#ifdef CONFIG_BLOCK -struct mtget32 { - compat_long_t mt_type; - compat_long_t mt_resid; - compat_long_t mt_dsreg; - compat_long_t mt_gstat; - compat_long_t mt_erreg; - compat_daddr_t mt_fileno; - compat_daddr_t mt_blkno; -}; -#define MTIOCGET32 _IOR('m', 2, struct mtget32) - -struct mtpos32 { - compat_long_t mt_blkno; -}; -#define MTIOCPOS32 _IOR('m', 3, struct mtpos32) - -static int mt_ioctl_trans(struct file *file, - unsigned int cmd, void __user *argp) -{ - /* NULL initialization to make gcc shut up */ - struct mtget __user *get = NULL; - struct mtget32 __user *umget32; - struct mtpos __user *pos = NULL; - struct mtpos32 __user *upos32; - unsigned long kcmd; - void *karg; - int err = 0; - - switch(cmd) { - case MTIOCPOS32: - kcmd = MTIOCPOS; - pos = compat_alloc_user_space(sizeof(*pos)); - karg = pos; - break; - default: /* MTIOCGET32 */ - kcmd = MTIOCGET; - get = compat_alloc_user_space(sizeof(*get)); - karg = get; - break; - } - if (karg == NULL) - return -EFAULT; - err = do_ioctl(file, kcmd, (unsigned long)karg); - if (err) - return err; - switch (cmd) { - case MTIOCPOS32: - upos32 = argp; - err = convert_in_user(&pos->mt_blkno, &upos32->mt_blkno); - break; - case MTIOCGET32: - umget32 = argp; - err = convert_in_user(&get->mt_type, &umget32->mt_type); - err |= convert_in_user(&get->mt_resid, &umget32->mt_resid); - err |= convert_in_user(&get->mt_dsreg, &umget32->mt_dsreg); - err |= convert_in_user(&get->mt_gstat, &umget32->mt_gstat); - err |= convert_in_user(&get->mt_erreg, &umget32->mt_erreg); - err |= convert_in_user(&get->mt_fileno, &umget32->mt_fileno); - err |= convert_in_user(&get->mt_blkno, &umget32->mt_blkno); - break; - } - return err ? -EFAULT: 0; -} - -#endif /* CONFIG_BLOCK */ - /* Bluetooth ioctls */ #define HCIUARTSETPROTO _IOW('U', 200, int) #define HCIUARTGETPROTO _IOR('U', 201, int) @@ -479,8 +411,6 @@ IGNORE_IOCTL(VT_GETMODE) */ COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ -/* Little m */ -COMPATIBLE_IOCTL(MTIOCTOP) #ifdef CONFIG_BLOCK /* md calls this on random blockdevs */ IGNORE_IOCTL(RAID_VERSION) @@ -846,9 +776,6 @@ static long do_ioctl_trans(unsigned int cmd, return sg_ioctl_trans(file, cmd, argp); case SG_GET_REQUEST_TABLE: return sg_grt_trans(file, cmd, argp); - case MTIOCGET32: - case MTIOCPOS32: - return mt_ioctl_trans(file, cmd, argp); #endif } diff --git a/include/linux/mtio.h b/include/linux/mtio.h new file mode 100644 index 000000000000..67d03156f2c2 --- /dev/null +++ b/include/linux/mtio.h @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MTIO_COMPAT_H +#define _LINUX_MTIO_COMPAT_H + +#include +#include +#include + +/* + * helper functions for implementing compat ioctls on the four tape + * drivers: we define the 32-bit layout of each incompatible structure, + * plus a wrapper function to copy it to user space in either format. + */ + +struct mtget32 { + s32 mt_type; + s32 mt_resid; + s32 mt_dsreg; + s32 mt_gstat; + s32 mt_erreg; + s32 mt_fileno; + s32 mt_blkno; +}; +#define MTIOCGET32 _IOR('m', 2, struct mtget32) + +struct mtpos32 { + s32 mt_blkno; +}; +#define MTIOCPOS32 _IOR('m', 3, struct mtpos32) + +static inline int put_user_mtget(void __user *u, struct mtget *k) +{ + struct mtget32 k32 = { + .mt_type = k->mt_type, + .mt_resid = k->mt_resid, + .mt_dsreg = k->mt_dsreg, + .mt_gstat = k->mt_gstat, + .mt_erreg = k->mt_erreg, + .mt_fileno = k->mt_fileno, + .mt_blkno = k->mt_blkno, + }; + int ret; + + if (in_compat_syscall()) + ret = copy_to_user(u, &k32, sizeof(k32)); + else + ret = copy_to_user(u, k, sizeof(*k)); + + return ret ? -EFAULT : 0; +} + +static inline int put_user_mtpos(void __user *u, struct mtpos *k) +{ + if (in_compat_syscall()) + return put_user(k->mt_blkno, (u32 __user *)u); + else + return put_user(k->mt_blkno, (long __user *)u); +} + +#endif From patchwork Wed Oct 9 19:10:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175664 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1173914ill; Wed, 9 Oct 2019 12:14:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwt64QuF4o0QoV8h1jTKCRq5STfGwovlmWHEzYgMt1C+WufZ+GEKaGDVNLrvAFJ3OvQT/a9 X-Received: by 2002:a50:b723:: with SMTP id g32mr4505882ede.13.1570648445888; Wed, 09 Oct 2019 12:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648445; cv=none; d=google.com; s=arc-20160816; b=08Fp2GDb95CFRKeUtbb7tcyryaFxmEQNr98lUDPbKwJtANCcX7zLi9mbl4Q0iB64iL lyId4ijLLPJuv7do0djlv5/kDoKLz8vC2SrMZGgx3KSYG8eua+zJGV4l3NrLUstD7q6L Iio60okavBuDmrx7UzZx56NBaID35GPS8KMWFuwS8TsvbG+mdoXzicuYh1r871UbZwCZ oaS8Ge41D79Hi5dtVddLRTXlBq1NNLlBI+O0AMF3u07KlIf0e3t+76bcPXM8od5LBYiZ 85MY0WQ7stBy4G4doVItYxIpYTSy5R7yeTVuVzGTvMMsoWYiO7UJ9yQIkMUNm+hkDyiS gv0A== 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=unR7ARBNyBS2eq6045OHNrOICFfdcRPNOC8Oj3pCmHs=; b=s4la3QdW1wkp/Nn2Qme+2RYPUFW9Qvhyqu6zSNAah2dICBuP3E4h6Cqg++IWvW6mvo USme8dUvNmQ6ALjfWBubA5oPUzS3+tjXB0rWy6cK3CZ+7mMH79yW4SXLGlCiS+2jy62t DC5nu4zm6q/ivS9/zAx77fYPkwCECPdVbNJfGAgDXH6bfqGJyGZeNCafwe5GAeHb2hE/ Ua6vu+06iWkAV12GSFiJF/Vj9mRLh1Gn3aeMM51jAhHjKHb/EDyvsbsG8ehTwlqlI4un kzsHoe42mJYGGIhgYqno4f1H/4Jw1w3bqcnpPZIdzZgv1A8EtVKaCNeuQuOJr2EZMphS WglQ== 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 f7si1655828ejt.155.2019.10.09.12.14.05; Wed, 09 Oct 2019 12:14:05 -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 S1732475AbfJITOE (ORCPT + 26 others); Wed, 9 Oct 2019 15:14:04 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:60635 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731771AbfJITLS (ORCPT ); Wed, 9 Oct 2019 15:11:18 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MLAF0-1iZOmA1c70-00IBAz; Wed, 09 Oct 2019 21:11:12 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Bartlomiej Zolnierkiewicz Subject: [PATCH v6 15/43] compat_ioctl: move ATYFB_CLK handling to atyfb driver Date: Wed, 9 Oct 2019 21:10:15 +0200 Message-Id: <20191009191044.308087-15-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:wR2NlVbiBb91Qld9p1E8SVGpgQSa/PNuWiWhAMD/fev06KiD/uN 7xAh8aX5DntNGju6RDV5on88/k6k0s3fIq+ab8ZleNgBUbADW3nutlhIlBOb/0TTD4E/0qv ZzA5n6ipyhv6KcGlE9eCcjyQdEQ/b7ByFb+HGKsJI2+RvYjK4HKWRPsdD2fcT7GKIg7+kDu ydGEUoRl4MUB7ItgTSCsA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:TCHutZOkv2g=:k7QecOAP0I00T1ZLxJ5d9v h47N6yxL/3wzF5sFbBGQ/K4UZvEokUYYSIm2HQfHF2kchCzxYnUUf5IwSMROQu1n2MjvSokxc iMsQcmI3qoOhPC1YI5BeA2eHZ+D2UjqAq0jOygB7xPLUQZSWnV7xzci7SLhiAzq29N5gINODk iT9JjSXFtW0W7WhqKjcLcuxf9Mk1xyqrEkspRsthq5eDbaO12WzdzTTkjq6FoGe6UWwyWqBKo Igwe8BiTqf296IT1+a2amF/MRtZiH90JEix4iOx1CeUTS1g1h3ROTw91SAyVnC75oFOpal5Sy x8manfs1I+2de5PXszzd4oZjFVKLAcm8koWAivK9SV5A+UQIE+06Pw2S7YZ4lRoNVqQzQcgTV f0tNu5UdGfRkYZM2N4F0KcuH5ZHRgL4n+7kbfnlArbvLPJ1gp+oQNUOFTC7C+rJD1+/XpXJmY 4M8Bfl64nrqRcJMaYyuFWDJGZzqGXbdGgI9MsGgSZXb8sZZwAiMAp+kMIidj2+jLBQdZ5wHq9 PhDpvpV7T4yVVM23XaoAuS08Hs64vdP1CyHsPBpSRksMMe/K24VEI9gx8Nhlk9qJZc5whUISR il/M1CF2X/cMe5OE99Clnp5qPuP9bqXZPajTpFpbOHnKYGW6ne6G1mYP8SULp+M041cPUC4fO LStac9VL/rUoEIQjjgp5n5Y8oHBxx65A1siXnaVX+DgUBeX0KE+cus4P/NhOcpPLrNljWWI9p qYMqsfX26hU4iRMcZQxUTuvKK1fDWAiIl6hf61DGg6JheUG3NkC+QeP3m2pVRju6e4zBWZSbn gVtlswksuGBtS8F9bihMEEWYgozi+Gm9F0xr1CYmMNxfsPdmQxXqr7qPsi/knipf/d5A5IhQ8 XXPCM2upXsi4/zq/l/Ow== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These are two obscure ioctl commands, in a driver that only has compatible commands, so just let the driver handle this itself. Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: Arnd Bergmann --- drivers/video/fbdev/aty/atyfb_base.c | 12 +++++++++++- fs/compat_ioctl.c | 2 -- 2 files changed, 11 insertions(+), 3 deletions(-) -- 2.20.0 diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index 6dda5d885a03..79d548746efd 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -48,7 +48,7 @@ ******************************************************************************/ - +#include #include #include #include @@ -235,6 +235,13 @@ static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); static int atyfb_blank(int blank, struct fb_info *info); static int atyfb_ioctl(struct fb_info *info, u_int cmd, u_long arg); +#ifdef CONFIG_COMPAT +static int atyfb_compat_ioctl(struct fb_info *info, u_int cmd, u_long arg) +{ + return atyfb_ioctl(info, cmd, (u_long)compat_ptr(arg)); +} +#endif + #ifdef __sparc__ static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma); #endif @@ -290,6 +297,9 @@ static struct fb_ops atyfb_ops = { .fb_pan_display = atyfb_pan_display, .fb_blank = atyfb_blank, .fb_ioctl = atyfb_ioctl, +#ifdef CONFIG_COMPAT + .fb_compat_ioctl = atyfb_compat_ioctl, +#endif .fb_fillrect = atyfb_fillrect, .fb_copyarea = atyfb_copyarea, .fb_imageblit = atyfb_imageblit, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index b65eef3d4787..a4e8fb7da968 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -696,8 +696,6 @@ COMPATIBLE_IOCTL(CAPI_CLR_FLAGS) COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT) COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT) /* Misc. */ -COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */ -COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) From patchwork Wed Oct 9 19:10:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175661 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1173588ill; Wed, 9 Oct 2019 12:13:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzH6/d53Tv0hul9B+v8ZagFlsuf1UsUWrImEJZId8HGD085Epgt7xwF53exagY1LcYBukz7 X-Received: by 2002:a05:6402:1a33:: with SMTP id be19mr4400495edb.197.1570648427898; Wed, 09 Oct 2019 12:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648427; cv=none; d=google.com; s=arc-20160816; b=D7vtKg3yf4tQjCbo1tz/2z5cOIsVTAl0N45Zn4yxN6QGWTeznd8L5qc543xEaRGxzM /vhPeLtEr39E9LR1t6f3bXrjmAtyijvJGb+hgtwYPBg3nN5LTbMkfyfY+fDzA2JZEtua 4vl6IaKh3cWecPiBMQQB8W9uj1rFznxZXOxijPRwuwMLoRZ5+EBge3vAtq/prH23m/pk I9WTI8zXkdsWCJJsH8UCvzBCPwKDS5aMOm3J9SFJ1C3s7G2lJu4GTIVmoF7B7f0zWI9O sEoE0PJ63fPPcHxCkpslYU9LNyPmpKSMxvvvdc++uni2nMup7r3jPR8gLH+01C7PGLP3 SSrg== 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=Nc+eDkoIrKATvZMK2k6LXzRf98VaCLOgHbtD28DRHSI=; b=dhJHLMw2NYCk0YGr85JtyvTCyZRC0UezA3bIIme5a8TBKW/Vt4XSHstj6P74QMiiqE +4oUaXcnXg+k9dPr8sHf6mWfli+YjqU6geu+lGHSkHtNcfAGm6kGD97QblrARpSf1z9/ SghR9rneFwmYIqPD3w5l9xZuDePaXgHECG02Qg/BvBNuUZpyJPoI8VmoGz1bUdwqOsEl PD1zfzhoqllmp9Y6WdLIicZ6sD/1qAQNbj8AhvLNd5NJESJYKqdjRsMyn0PAr08iDn4K hExGC3+nAhJslT+9c9phqfX7t7bCcmRGDsxl4RFt/Kio4m+kETjYVsa/5CWtAtaqHzuV hn6Q== 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 w2si2082575edc.386.2019.10.09.12.13.47; Wed, 09 Oct 2019 12:13:47 -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 S1731947AbfJITLU (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:20 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:45889 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731144AbfJITLO (ORCPT ); Wed, 9 Oct 2019 15:11:14 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mzyi6-1hupE6357e-00wzdx; Wed, 09 Oct 2019 21:11:12 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Karsten Keil , netdev@vger.kernel.org, isdn4linux@listserv.isdn4linux.de Subject: [PATCH v6 16/43] compat_ioctl: move isdn/capi ioctl translation into driver Date: Wed, 9 Oct 2019 21:10:16 +0200 Message-Id: <20191009191044.308087-16-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:3PgdTLn3Isb1E8QdaS6ssQ4smTcDkiVZALshacjmZB+AtPbu7Xq +7o5fh40aOG53PwqC68L1xQv4R2rrEcItv3d09B+15mWfs5dq4Tnu4b8BuUmfRm6UOVmtZd zpvGOs+siVVcUrX1Q5s/nr5A9T4WhMwaKm/3W3e/li5neiNanzGsyRWZwZ9MgEx1znyplrR z2rwUeFAJ5Ft6735YtEjg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:hRo8ARl3Sq8=:RxMdqFFZ5hfQWKhBpuqbgd VS0ufeKpg2n65gq107Tujsiiq+j0BdkpZ1R4QKawR0mc5fAuY4/lBYRLNImDpCjMevgpRCMhS G+IWYfPMqCzyHXrQgLga8GTWM4/Po7Y7g0TRBTXe2vAC75g2YRgEGafbq7pPLnVrwpBHuDnKE hYqyjFb6eMjZstGJaHM+tbsu/QZHUp+gzLmvB3hbOb4Gt3tLwKWyaxJUxJfwl0jPz1Eq2svQr 5ylyHlpXJhYZjR4dGwBSOa/MP/aORnAVTAvkgegWEnGuDWCmzpiw9kKM3laiA1Z14aKmbe2pI DEc6POaYmrmL6VvCpSxUne1lQPdReizm5P3e52Vw2DNbQAkoG6dsj5x5cNWqmVyFas5TbQ8ay zvflQxV28Zo3vv5oom91yCx6kBhGNmsLeI/4GWRM+V7Vq+6Hkh7ZR/IMaR71BoH9Mv4yule5F OWym6mvP3Rn1qvAONZ3687WR8lb5vtbRq/M/zGS87JoV3dzUACYtw1VnLsmi/wmJW0cGhds6K qHzVxrBqquqPb6hpqU1+y0XUTkYjiL7QGeYnRwSTXYEuNF2c73ytZSBEK3xTnkBimnzI0QS34 twk72LmazvX8sXsXA+PVkFaXABTgjMzMQuiR37IiPVYC1RkysRc1Tj6uatBg436LsDo61CWTP BHTQDUsSH76HOsy2WpWeuMpABGuc8yAWabElkrVTAbGFXyZijT6cXb/i69ProMiSWhwKi1m2v cVBieHv8EWbJhV0V//EUVyF02xmhqzHOVJ3Ou6Z3eGtBeYHIvxN8PaQODJPhzzftQh+buHYpf KNhSm/38Ro+OTlOUHCLCk38lUx+vQSgTFhrUake83fButfk9TTsrL2/tYHCFmJ3/18ZBN7oe6 FvDmcjfQbzxT2tWV1cgg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Neither the old isdn4linux interface nor the newer mISDN stack ever had working 32-bit compat mode as far as I can tell. However, the CAPI stack has some ioctl commands that are correctly listed in fs/compat_ioctl.c. We can trivially move all of those into the corresponding file that implement the native handlers by adding a compat_ioctl redirect to that. I did notice that treating CAPI_MANUFACTURER_CMD() as compatible is broken, so I'm also adding a handler for that, realizing that in all likelyhood, nobody is ever going to call it. Cc: Karsten Keil Cc: netdev@vger.kernel.org Cc: isdn4linux@listserv.isdn4linux.de Signed-off-by: Arnd Bergmann --- drivers/isdn/capi/capi.c | 31 +++++++++++++++++++++++++++++++ fs/compat_ioctl.c | 17 ----------------- 2 files changed, 31 insertions(+), 17 deletions(-) -- 2.20.0 diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index c92b405b7646..efce7532513c 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -950,6 +950,34 @@ capi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return ret; } +#ifdef CONFIG_COMPAT +static long +capi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + int ret; + + if (cmd == CAPI_MANUFACTURER_CMD) { + struct { + unsigned long cmd; + compat_uptr_t data; + } mcmd32; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + if (copy_from_user(&mcmd32, compat_ptr(arg), sizeof(mcmd32))) + return -EFAULT; + + mutex_lock(&capi_mutex); + ret = capi20_manufacturer(mcmd32.cmd, compat_ptr(mcmd32.data)); + mutex_unlock(&capi_mutex); + + return ret; + } + + return capi_unlocked_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int capi_open(struct inode *inode, struct file *file) { struct capidev *cdev; @@ -996,6 +1024,9 @@ static const struct file_operations capi_fops = .write = capi_write, .poll = capi_poll, .unlocked_ioctl = capi_unlocked_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = capi_compat_ioctl, +#endif .open = capi_open, .release = capi_release, }; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index a4e8fb7da968..f3b4179d6dff 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -44,9 +44,6 @@ #include #include -#include -#include - #ifdef CONFIG_BLOCK #include #include @@ -681,20 +678,6 @@ COMPATIBLE_IOCTL(RFCOMMRELEASEDEV) COMPATIBLE_IOCTL(RFCOMMGETDEVLIST) COMPATIBLE_IOCTL(RFCOMMGETDEVINFO) COMPATIBLE_IOCTL(RFCOMMSTEALDLC) -/* CAPI */ -COMPATIBLE_IOCTL(CAPI_REGISTER) -COMPATIBLE_IOCTL(CAPI_GET_MANUFACTURER) -COMPATIBLE_IOCTL(CAPI_GET_VERSION) -COMPATIBLE_IOCTL(CAPI_GET_SERIAL) -COMPATIBLE_IOCTL(CAPI_GET_PROFILE) -COMPATIBLE_IOCTL(CAPI_MANUFACTURER_CMD) -COMPATIBLE_IOCTL(CAPI_GET_ERRCODE) -COMPATIBLE_IOCTL(CAPI_INSTALLED) -COMPATIBLE_IOCTL(CAPI_GET_FLAGS) -COMPATIBLE_IOCTL(CAPI_SET_FLAGS) -COMPATIBLE_IOCTL(CAPI_CLR_FLAGS) -COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT) -COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT) /* Misc. */ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) From patchwork Wed Oct 9 19:10:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175637 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1170593ill; Wed, 9 Oct 2019 12:11:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNZk55woKlV1sHJnFtuJsvu8R1saf75zgGltDDHGzfL3NDCrfhBH1b+/e8tGKwAGk0m84r X-Received: by 2002:a17:906:1e55:: with SMTP id i21mr4447331ejj.47.1570648279116; Wed, 09 Oct 2019 12:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648279; cv=none; d=google.com; s=arc-20160816; b=CUA0nXcZWLs0mWPZBYHMfXUV3T3uWaXGy/KNIprrdCyslNqvejTieQrNLAl1IJvb62 8msxW4fdFLOZgLpKBScvuS7nBe8rDnRtZa5U/rtdIYS9aKVsat1lxD9RHVrJvqa/XZIy Ocuw65Q07dYK/Jq3lhvdcEARYYL+uFAONadUmaDrLtUvu0eI7EtBTBqtGgckdttE0ywI XhoNNaLDjSYfxo8u4NMD5TuJmbC+eY2pYgCxFJGSWUcncNTiHGeEtYtx69WNW60UmLnB 55QflfHf6TYwCRwAYpzrYlDMYWm4ZSR7oW+JL+GWJfrHxzvYeRIsBAnZth3Am3juikZp Svmw== 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=PfjU/ayAJq15WMno9c6/59lGqLQJnO4pL/2trXfTXAA=; b=yk/quQSk11DXQA+1lywqO6ZR+aCJFJVjnRjwUtAEEYBZANmiLXDLj7QPv7lUYNpmre asXnba+gndR7SXf3t3xBuKufw/t9IOHwssrI6KIikMZY7a0+lRCeM8qJ98xobpAQTsZW omxBvl68pyKnFbpXM+bvTH7131ZpS01J2LmqxcEqGme/4YGlUMe/wMduABl6oqM5gSEH qMHmJKb2djb78+D3HyTWUanwEFR5ANIbulB3z/LsBQE7MEbZppubZll4zrkcqflNOd9t r4q9hqTVN3EOOYsFJ+XbhBBSnWN3sq4xzd0Z906U5NewkZtff4cpSPnmkKyDjK/eQI0J EAmg== 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 g30si1996732eda.2.2019.10.09.12.11.18; Wed, 09 Oct 2019 12:11:19 -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 S1731911AbfJITLR (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:17 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:38647 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731771AbfJITLO (ORCPT ); Wed, 9 Oct 2019 15:11:14 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MiJIk-1hd9qo47VO-00fSl7; Wed, 09 Oct 2019 21:11:13 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Marcel Holtmann Subject: [PATCH v6 17/43] compat_ioctl: move rfcomm handlers into driver Date: Wed, 9 Oct 2019 21:10:17 +0200 Message-Id: <20191009191044.308087-17-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:6o+fXd+jknkQ9Kt+dvDcH2dQqv7QFvYbBe3gxSyUw1PSROtnjoC 7emE8+IitiN6xjQXFyhJvQU8e1C2V+fxOFrCYIjgXTdqqHASt08GP0Z1d5xH9MzPLbtu66P J9oEstuey1r2im/khtnqN9ZUzi0/bdwd6fjul/INAkUaVFJARkaZ6IBSzGf5Q1Pru86T3TC RUO7i6kp1LdP3l2dPUNFA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:TfUEyc2+NPc=:HQ0oFvhTGn1RZEKc3Ghs8F mZuFQC5DGwW0zJ1yLyyIvNeHvHuFx2WYnZpYMUgR75C8zilFGgZTc4FT5B6U4YrtxF94LBsT1 aFMmGPdcXt3X3Aa3biEa6q2oPA+4wDN+MLN/zPKC3nFn3fip0Y8Ph9g6D+O4LLGBpgPmBOQai L313sbBBBn8EOvb9RlOjvEr0BvXcNml2Udlk1AZ0uMGYovu1N/CrBckv/sNivfiofL7H+n6OL 5lPE/xH8R4808YhlRKFaObMEh7wUTg1X0m0VgvitGjs+vFHoqHpN0EkjVJF5mGEsdHsPSCIhZ Zvk8BvJDJJDvoNqa6XQyxJgiicAHJmt6WogcBOLTkKkfYiBx7vFVcI3OalPhRXlz9skpAyosl aol1tZ9f05XoxVAZSnA4S/wsNUlVhl9dvb3AAt/U1MaJ/wiIvB/YnHdgIVcRNuZ1y1Dgegx/E 3/kLeXDYe+WOmNrgbmQejT1UE0eiMez6lxw+Z3n7huo5J2ceBwVLX8Q1z01DCfbRK1utQAOLJ QzJtytYoLkP8jVy0gIiZVyeaC6Ls73n9P7B0k/2i2aZ0zPruP52dMpl3d7jrxoNEG09l7k4cE ICvpgihvMHXrUVrfYGnn7WV+0KxeLDFBeobqJ59+jkBO2qc4MyZ2ca7nCYLsIGI+NcINZ3IO7 8as8Yb2CgQBuqBm3B/qFhfjL7wrryfshgIMCxyI9eWyV0bHZEDC+S7Qtrr0T51BE+q2saKwmw JkbP3mfikcWSzZ5f27InGlbpd+5I8g9LLtKFRMpD3PR4Nt2Np/9m9DIE1f9Xr1/gSZarciwhE 9I94MxMItu1Wl/uS3Uu3Uygx/LjFAFM3nWx2mamLAUG0Bx2iYbWpCa8qU3NQ/gSDMdGSGchra KsI1SHv+a3ZDDUWuGHLw== 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 rfcomm/sock.c and remove the listing in fs/compat_ioctl.c. Acked-by: Marcel Holtmann Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 6 ------ net/bluetooth/rfcomm/sock.c | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index f3b4179d6dff..8dbef92b10fd 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -42,7 +42,6 @@ #include #include -#include #ifdef CONFIG_BLOCK #include @@ -673,11 +672,6 @@ COMPATIBLE_IOCTL(HCIUARTGETPROTO) COMPATIBLE_IOCTL(HCIUARTGETDEVICE) COMPATIBLE_IOCTL(HCIUARTSETFLAGS) COMPATIBLE_IOCTL(HCIUARTGETFLAGS) -COMPATIBLE_IOCTL(RFCOMMCREATEDEV) -COMPATIBLE_IOCTL(RFCOMMRELEASEDEV) -COMPATIBLE_IOCTL(RFCOMMGETDEVLIST) -COMPATIBLE_IOCTL(RFCOMMGETDEVINFO) -COMPATIBLE_IOCTL(RFCOMMSTEALDLC) /* Misc. */ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 90bb53aa4bee..b4eaf21360ef 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -24,7 +24,7 @@ /* * RFCOMM sockets. */ - +#include #include #include #include @@ -909,6 +909,13 @@ static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned lon return err; } +#ifdef CONFIG_COMPAT +static int rfcomm_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) +{ + return rfcomm_sock_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int rfcomm_sock_shutdown(struct socket *sock, int how) { struct sock *sk = sock->sk; @@ -1042,7 +1049,10 @@ static const struct proto_ops rfcomm_sock_ops = { .gettstamp = sock_gettstamp, .poll = bt_sock_poll, .socketpair = sock_no_socketpair, - .mmap = sock_no_mmap + .mmap = sock_no_mmap, +#ifdef CONFIG_COMPAT + .compat_ioctl = rfcomm_sock_compat_ioctl, +#endif }; static const struct net_proto_family rfcomm_sock_family_ops = { From patchwork Wed Oct 9 19:10:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175673 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1174881ill; Wed, 9 Oct 2019 12:14:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqqSl109+J+Z68XbkspKxQ1IPsl3eK7LUiqpxcEk3Jc1S+v9r50F/m1TsHx1O4n8FKdr7+ X-Received: by 2002:a17:906:1c87:: with SMTP id g7mr4483297ejh.189.1570648498540; Wed, 09 Oct 2019 12:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648498; cv=none; d=google.com; s=arc-20160816; b=X5YENLYvT0dYrtHG4g0uPEYd7geu7DG5FxDgHfVlqU3ndS+lbm6SDNIvvNuqpw2X5P Nonvmy+rJBQeMN42q/hsUPLHoFu5ETzn0USn4gdLG4gfiyTjsDEkIVuMfkCsmv7o9bCD G/Pm7tRZtVd/qMUbpACw9XYnSlhVB0ncQredKNiWWR3rjs4Qhd/i/8qFjC7IniMTnJ/R tTKAYsv/9gixjKy0oerrPBY+S+bfoGSp+M1IkCwMhR54XUl83myfxOKWdD0RyewtEDQV k6EPO3d+ENy68NxXHET1EF1WOiyupZGqhSOm/rJo4m5qEzXspBkZiak3F6YP4lkp2Mfv Jq4w== 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=ugjVMuHRibwyGfMLs5qqcgqXyCfQmJuDc1s7GyvZzmE=; b=uDUM7OWdPYS4qzEJ9NaWcT7IoNBOshHrzo4ky/NOCGvsC9k21OZHtf7GFdU9eVwfTM gSAYZgkT/cliG7DmjitV8tNd2JAGoPwtCbHVjXlwdPt7Rswm9MoE7BXiIjc5k58S7HXK ZwSnk3llJKI4oYTgzvUZK+LtExwYbf7jSQ5ca1wVGSDHPc2EvSsjFuceFpN64B/R6WhM Q43TavuhRvKBYpajKl61emQXw4hAv+jTPEfY76jRcLk/ixsRoo3TWh9D1j3ob+FCz07N dOLId9lcWut2UNfewGS9AS02bVFtAP3s5JcM8TU+m+e+hqZnakCE7shA9NQ/p1c+tN5z qsqg== 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 e22si2005231eda.300.2019.10.09.12.14.58; Wed, 09 Oct 2019 12:14:58 -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 S1732143AbfJITO5 (ORCPT + 26 others); Wed, 9 Oct 2019 15:14:57 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:33077 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731798AbfJITLP (ORCPT ); Wed, 9 Oct 2019 15:11:15 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MI59b-1iLGB40u1P-00FEcy; Wed, 09 Oct 2019 21:11:13 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Marcel Holtmann Subject: [PATCH v6 18/43] compat_ioctl: move hci_sock handlers into driver Date: Wed, 9 Oct 2019 21:10:18 +0200 Message-Id: <20191009191044.308087-18-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:3b9/EnEmRxtjq9xec8nuAiDp4EeBAPlIlguXDpmUbx5+b5wz/3H vVaQkpTtaA/szT2d3L/bAiVbxOuNJTxl1WQpIlu3yVpJDiXwTWIseqYi/ZFt8Xp5NwKArDY rOLB7Nc92AJX7A8KhERCB71rlnqDPMm0OcGDrzJFp2ADsTnCkpe7bVTbbsVZq0qW7AdSGSh 3L7dkLWIAfN034tnXTrzA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:lrKm9W1vy5Q=:FrUQun1LEglGNsblDtuJIM 3/8y6eHSHjcHUrag6kQIOcmvyt9XVkmrJouJTQx5HZCspjXg6PjVGEMesPfPNs7Ifj5Tk1uua BljHakosdQWFnAULMNU1Ws0WrLAl3yx/DT5p3YKcKMnhweMTkQRNtmM5X+Q2wjcfRZb0Wz9Vk tbkc0JFksT5ghmO/A0GOxN+ZqHG9Cz57gdQUmyHSvvMazkZCSqlST4uBKS8w5l9UdeUt4R3TF ahIQ1qculoOibIUplUodcfG6jL22UukgMrCXtZ97jGIhxZw4pNjW8aYZUltysnveOaatIU+85 nd6KmiAyAf8gMzUZ+eGsFgb4kYLtXMtt+vcw2emMkTQoB2ts6lQsjGxlzvuiALG8eJZi9lUgz AV0KdvnmlIOHI3YcdUJjT4/tU2SFpditmA/98J6q4S2TUIpwm5rSuOF8UrCoabxiGi+xHh/3M n4/1C78ksCFTFnGENCX6PcT8epFaC6HBoIh0t7uxsyhtfJtlKSZmbkeLZlMYdX5MAX7rjtDOw ELSRxeOHXOGNilEuNmJw0DFVR5VVJ4s1M4hNxQZyoerPzU35l7BCurELkJRnjXjzejxrwvc0p iY7CIF1uLlozw3aB42OquZ1nrvM+FmKie47F0lckkGxVlTYCsls0ew/x9PO+3Bb1h8QBeTgrT i+x0t7An9ig8Hpurgeki8w+jTB/6uTIKA9YjcLV+pugJGzK8hBKnRE5tc0RhictQ6/WQMKRW/ HvUJygiFQ+YPjQr4W1MisU5dMiyXaZGy+UMpGg0XdreoIIAkAhaBf7CWd61KFqqZtW7ahE5d/ etNyibqz1M4nhPvXNDDYj3IKmiMHOeLLT5w2vnRjct8PJcHgA/DgEsDF1yslnFDyH2Hou3qon Zp9aPGellO4i0EzELdKA== 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. Acked-by: Marcel Holtmann Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 24 ------------------------ net/bluetooth/hci_sock.c | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 25 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 8dbef92b10fd..9302157d1471 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 @@ -646,27 +643,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, From patchwork Wed Oct 9 19:10:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175671 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1174762ill; Wed, 9 Oct 2019 12:14:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqmc46T3d7vY8UIc7u7aPByrJlZhedUMa88SIkiuJ2F9TLe+3wSZmef7tOIBEO6oMEHCZR X-Received: by 2002:aa7:d04b:: with SMTP id n11mr4552642edo.104.1570648491216; Wed, 09 Oct 2019 12:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648491; cv=none; d=google.com; s=arc-20160816; b=RN0RhFR054W5Uc+TTAunGpZvWgwo4EI0MDtiKfYHd1iZQDeqQcw2hqxyua7uTrQE/M SMhDqJvSs1IfqSJZ81m2eekVxfn/X7kRh+X1KBYk4+nJb8sYtf5fQBm7aOSEvwM0XITy CS8r45RM2zBRXSJY2BlHkonqkEjIt2s2P1BRi2BVpLB4f4nEaiQ+m/4Nn9foEMmElZCy 4T/DEpFs3QUEpN7CX6xLXmQDtOdyOZVPJwWI5aQfNDaCedTyYRQB1kyfOknR+6jDMqGP 6vEuBsyChbrd9yET5bhh1zDS0ekYn0LNyybFjQjMG4DVZVJbQ12OcP+UN6D/8QRQ80yj LssQ== 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=87qYb+Q1dsKiL4D1i6EXiyBB/FguEAdfSGn258nkH+Q=; b=Sil9/mBXUc+lsqZBEJj2PgLBB5pf/PWGveYwNpBNOXsYBGU/NeG+BjXX/9dUyG9Yva l6lNTj7TsGttWSqAGzQdl6BUhIQ67Tbx9pO7WjWzL8XxxAlBAaTLUZn+I2NujdfDp6FS h6tnBNdu4z+XTk8RInLUWRMAx5Nvtvz2e4ttDYEngCkvEAxUkrMQIPdLys6MQXWUiceT hRyQNjuYDbNWunvowrcBkZ2v0+rhFqI8ZNy4IsV33E2R4a+V6x7azqiFFjQczD/KH88d yIpJhtBCxm5TUuRq1NGcNs5Cxnd68qVmBsbZEONpCTpl+/JJnev1vf6tbCCMx2dFQZuz zlsw== 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 e22si2005231eda.300.2019.10.09.12.14.51; Wed, 09 Oct 2019 12:14:51 -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 S1732541AbfJITOp (ORCPT + 26 others); Wed, 9 Oct 2019 15:14:45 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:45961 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731801AbfJITLP (ORCPT ); Wed, 9 Oct 2019 15:11:15 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MeknF-1hiOma24ph-00ao3W; Wed, 09 Oct 2019 21:11:13 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , linux-bluetooth@vger.kernel.org, Marcel Holtmann , Johan Hedberg Subject: [PATCH v6 19/43] compat_ioctl: remove HCIUART handling Date: Wed, 9 Oct 2019 21:10:19 +0200 Message-Id: <20191009191044.308087-19-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:8aOTXX6TdEpU5/KgUIDONK80ND60yvXM5iK1bsPvn2pkU6Qv7sB n/GqURBo1FAIM5bXKDZazKJNmUMRNOCbXlFqat9iQsMxjMHEOb1c/aeZJIVOlrfV238DfTO kwvpU5H7UvxKocPekysrSHac5yjk8q0H/UkP0dhbsP+jMXmAwlylYAfz23ozNqL1nlUZ8Rq zPi3DjTuBjmifhy+Ncn7Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:SrUTzCjBBoI=:BECAHyoNcZAW+KdZHIWkUJ 2C39Q9P1Dd/xKvUP3Jsq0hr/FmPw46oP2wGHfrYJ5XzoQXHHWNsuNccN/bjT2E2c5x2Xn8M/X ezAZPafZ5IlFnRsaWK0OWDO2MG0NUeO7R0Qn/fvx85MFFy5nJ9ULFM7kxwz+e/nEAVyd0NKZw 0PExVtFaIkubIXtjIhsrUxQNMZQxK/0xPS77hkL/ILy+TyZYeY+bnKpOGh1nqABGHvvVJutLd yj+lEdtRdp0dBodYoww7V0xXEwSxXwGaOUE6gJoTHtbEI4qxmRN0OYNdr/CPUUk/hLa54rCJR WivIwdUieHhhtM1PeTxsLbCEMQTDUHlSHlXKVVzNXeiUE94lS25xNUi/2xZDLbNc8zpnq/C5f PE/g7EYT9egMa6u+IkveEtFUyM3dvHHOC2tnDOHo60UpWU4W4XKb/VwAMd6WJcQmfDNKeuQyo HMJxG9gc0lkg+kA7r8CV6Sr3b359LYoMTvEk5r8dGOKx9XWYYjsTVswgHoVg8RRI3m5FYW9ek DJAfXEMHu7+EMGbXQQBf535jz/VAgZI2js1TauHADNOwzkeCeviTqMPf3r+/TsN+blUMrr0tO lDI6A+InPPdbUcXvJ9/D6hZSQXKtFYOwWOcFxMWGrKh/ANvTTqU54/J/8nd7KfBE2EZ5rNrT5 FJ125P6CJWssSCQTPj1Lw0UD/BsqqKRXb5Ebq9K0naUWJE+mNrwjJphtkHRDWXQazxtKILNAU bUN4s0FH3ujrGTB8/Wmjsclu8gOABaDqkM4zrQcjDdEr7n0LpOSJtKntIiRnnyHmYP39KTnxP bGprJkQ9uUQ6Q/pwoOAXUTqyy+QQCNDKof9cM+olwAYI4B2PEsFcYUzdFJYaqaAyQ1XHxfbxd 0gOha65Em5TnZKzkHHGQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As of commit f0193d3ea73b ("change semantics of ldisc ->compat_ioctl()"), all hciuart ioctl commands are handled correctly in the driver, and we never need to go through the table here. Cc: linux-bluetooth@vger.kernel.org Cc: Marcel Holtmann Cc: Johan Hedberg Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 13 ------------- 1 file changed, 13 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 9302157d1471..758b8b934b70 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -353,13 +353,6 @@ static int ppp_scompress(struct file *file, unsigned int cmd, return do_ioctl(file, PPPIOCSCOMPRESS, (unsigned long) odata); } -/* Bluetooth ioctls */ -#define HCIUARTSETPROTO _IOW('U', 200, int) -#define HCIUARTGETPROTO _IOR('U', 201, int) -#define HCIUARTGETDEVICE _IOR('U', 202, int) -#define HCIUARTSETFLAGS _IOW('U', 203, int) -#define HCIUARTGETFLAGS _IOR('U', 204, int) - /* * simple reversible transform to make our table more evenly * distributed after sorting. @@ -642,12 +635,6 @@ COMPATIBLE_IOCTL(RNDGETPOOL) COMPATIBLE_IOCTL(RNDADDENTROPY) COMPATIBLE_IOCTL(RNDZAPENTCNT) COMPATIBLE_IOCTL(RNDCLEARPOOL) -/* Bluetooth */ -COMPATIBLE_IOCTL(HCIUARTSETPROTO) -COMPATIBLE_IOCTL(HCIUARTGETPROTO) -COMPATIBLE_IOCTL(HCIUARTGETDEVICE) -COMPATIBLE_IOCTL(HCIUARTSETFLAGS) -COMPATIBLE_IOCTL(HCIUARTGETFLAGS) /* Misc. */ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) From patchwork Wed Oct 9 19:10:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175669 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1174583ill; Wed, 9 Oct 2019 12:14:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqx00MmNu/tblun8qPKUGplf3kHh5ExA6GfRhEC3IQX3xh9V9+Mf+NnzfddN2GpwGZvNyk6M X-Received: by 2002:a05:6402:886:: with SMTP id e6mr4582508edy.152.1570648479793; Wed, 09 Oct 2019 12:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648479; cv=none; d=google.com; s=arc-20160816; b=Ho68PFQk2NAWvGOUHJPfYdmSnQXMK0cxrweoZi96988PhY6hwq0McTB/yQQ9fggGHO W9u/3zCidgmueyjoiQlrGkLwV2IWE0el3hFIchOwjPAtxwixKyDZP4OptiHalDSyXOM5 44C9klyeg564J/KkA0hvK7H7xXlQIWyGRFmegliJSghsn3/f8USbD+thiHVX9ft19xPt 5ZWqhAWSBmhB4jzhq8gP2tcFip5XC/zRR8RFa89hFXivZYKvR3LJEPpqfwoKRSeBuEGv v8K5oJWAIiWSj824N3IcXRfSdT6MQPuP9vR5bPBf9sgN9gw1yI+OFT73LuTwDBxEe9el umNw== 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=Hmxjaat5qugSE/HexnSUZfSxauGWFFD3U4J3MxSVZpQ=; b=BNaiVlY7zwmQHi9ISaAK+EwelR+erdglKyhKoBzt4k8/MZncuhXMmC1m+fRHQ5KZsG wVG+778tpz8XLQZtEW8Tq0ADm/ZPkFa9r/IOZFQeASVk9m4WWfbAsL3tDa3+vWLmCSsS wU+pvs9bX8KYD43CiuseRp6YgnZ9DLJ9O0O3Qr46SouTp5yus2n09hegFkzaP853h+Up f9KNKGjfSRx/Wmv254KRqAE05mw7ah3+dl7w0Jb4LePI6kFvP9iOazPEQFCd9t3mGt0L QUyg2Y7T+ArLUr65i6G0j0Cv8f5UvEEEy1HRLTD5y5oUfTLDfHGR0mN4+8N64wGjxb5K uUJA== 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 j12si1672315ejx.282.2019.10.09.12.14.39; Wed, 09 Oct 2019 12:14:39 -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 S1732529AbfJITOj (ORCPT + 26 others); Wed, 9 Oct 2019 15:14:39 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:44107 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731815AbfJITLQ (ORCPT ); Wed, 9 Oct 2019 15:11:16 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MUGuZ-1iiRKk3Akl-00RHrY; Wed, 09 Oct 2019 21:11:13 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , linux-bluetooth@vger.kernel.org, Marcel Holtmann , Johan Hedberg Subject: [PATCH v6 20/43] compat_ioctl: remove HIDIO translation Date: Wed, 9 Oct 2019 21:10:20 +0200 Message-Id: <20191009191044.308087-20-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:7RMTQj/IzXWYNqxbs38UjXmvOPx/nPUg/Jyhl5K5JkL70CQCnF4 P7q/KM2dZFFM1mtdBuyaIqUOFQ17HlCzmqS0tuXPXTEirxZH9GS8gORXXirs/gILMvMEyja 5hNst7E+UHJdZxWMQnw0p3I0VbnvpoDPWpJHRD/vsv8+rHK2g9WQfQad4vs+tpXs/xmRHjT MbggUfSSb6Uvr6f+ZBoDQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:x0djXe2zRmc=:ad8+YXein6bQ0QFyxFmaf5 3H7cUXons26UtN1mFsrj6+7EPNH5+j8wl04KuKJboRJXY6swmLiRvc2JyvfLrEwlXQnApxrrp JsHHkVh32zh6mpb/a1ZZzohM0N9ua+czPNFXB8Y5VKPHQB88O2yvmWRJ5v/EO/6e5vCMqGOGn HZQrkA8YxrqX8y3mXBAlsGQgF6eWxC9pet/+6xkbNcvRSiUfjTtwLO/D/1bdK3RjjVrMtfX13 Xf+DT120gHyHUcN0adf2srndF+BLmhNdds4gL9y+YukBzCKnRd/MrjS3PYPYs5CWwjMpwADFF ZXD21oeBdqGpQ9N2vhzZzGie+FQ/0pV3U8EI7RuzDHyv+HvmODurkqCyQ589vXvvkzeDfbRcl HfFO4XhgNzIKLH2PYpsoE21njqZi8n6u5N8zxYxCSyenIemzI1RWzck/FgqetAymWZeEkblrj xuJyI7N908igBl2AWWo8e3QHjMmmKzdx+blAea9rfGZAK7/FKCF3sdtZBV8OhbFgD3rWEPtTI Iwx1yNMvY4hiyhHf8ajTTJRvCeyMigqy/MorBDgZNFJdj66MK4Zlx/Itv9rjcv1S8pfERWjlI kZbOmbjKQG+w3GcxfAfeCJvE5uqiA+DYh4yJA1duY34hTLQsvBR8qKr7g7lPJpJMlp9C+TCEH YB+U6wL6C3kRUyp8skEW6cwIp23vVHz9t8WH5nvk6ypeLbdays2PKFEbiD20MRjpCZXCpgqVB Qs5zxUonl/onGJKMvt8dIrbIEdGPfGgHFFX4LZQRmmFlL5iuHF3xzgThTj53kV21/1G8oUnpW bomS/5kPMX2XtDxewQlWEkfyyOlvZFLk+OwzZg40ihqyPe2xvxr8qIM1sICy067JDcGPgnlzg sBUW1gq3ojBcK0FdJojg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The two drivers implementing these both gained proper compat_ioctl() handlers a long time ago with commits bb6c8d8fa9b5 ("HID: hiddev: Add 32bit ioctl compatibilty") and ae5e49c79c05 ("HID: hidraw: add compatibility ioctl() for 32-bit applications."), so the lists in fs/compat_ioctl.c are no longer used. It appears that the lists were also incomplete, so the translation didn't actually work correctly when it was still in use. Remove them as cleanup. Cc: linux-bluetooth@vger.kernel.org Cc: Marcel Holtmann Cc: Johan Hedberg Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 17 ----------------- 1 file changed, 17 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 758b8b934b70..03da7934a351 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -640,23 +640,6 @@ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) -/* hiddev */ -COMPATIBLE_IOCTL(HIDIOCGVERSION) -COMPATIBLE_IOCTL(HIDIOCAPPLICATION) -COMPATIBLE_IOCTL(HIDIOCGDEVINFO) -COMPATIBLE_IOCTL(HIDIOCGSTRING) -COMPATIBLE_IOCTL(HIDIOCINITREPORT) -COMPATIBLE_IOCTL(HIDIOCGREPORT) -COMPATIBLE_IOCTL(HIDIOCSREPORT) -COMPATIBLE_IOCTL(HIDIOCGREPORTINFO) -COMPATIBLE_IOCTL(HIDIOCGFIELDINFO) -COMPATIBLE_IOCTL(HIDIOCGUSAGE) -COMPATIBLE_IOCTL(HIDIOCSUSAGE) -COMPATIBLE_IOCTL(HIDIOCGUCODE) -COMPATIBLE_IOCTL(HIDIOCGFLAG) -COMPATIBLE_IOCTL(HIDIOCSFLAG) -COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) -COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) /* joystick */ COMPATIBLE_IOCTL(JSIOCGVERSION) COMPATIBLE_IOCTL(JSIOCGAXES) From patchwork Wed Oct 9 19:10:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175640 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1170809ill; Wed, 9 Oct 2019 12:11:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyM9QR9GqO2ubvaLNp+INRUXnKx8WwyDgNt5ZJqhv5fIFRxXHCP97aHrQHfLtUQvgTkbaAp X-Received: by 2002:a17:906:46c7:: with SMTP id k7mr4426778ejs.112.1570648291478; Wed, 09 Oct 2019 12:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648291; cv=none; d=google.com; s=arc-20160816; b=oiJgRqTJ06DJu2mmkAAjtYociTRdgmrpMSaNnoLbFHdGzEo19pq7Z2LI+r0a0lGNZU cZdNmT3Vb13itB5aIAL2t+ympUKmoC93J8NitSXHQw7MkwCIn7YWPhdDO//tSRDSDMLG 5FJbnHTea6vDdc3e78o4lEPKR1++67rFHx8ZopDUI16XfbFrlTDgNrRnbmv/OntwQl9+ fpH7TTEsgMpGM/KKckHxRyaLkJGYmJbr/nGY+vYR19OSgwzuvP3HFyrN/SunbcZSrQ6S udtki8dNHYXrXQacH17AbM0H6kDLaJm8ChB+txcZBje5o5G21jC0qG6Hm7yAaTNNxTxf XJjw== 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=M/mLUcFdkMUW39drjDrUbUohXcCuv+6LAE69vbw9CvA=; b=q2PWfTVwXU8StN3bjS9CRQa8XHAflO50gZux2w+H5L8MhmXD0L+Iw6w9ZPzt2zkrSz ABiXzNmvfez9S+JQWam7M93eTWzfl/G0C0dRAjP1Y4dncIDYvZ7KioN7/eP2QQzuK9/z pCJAj+jF0PmYMW/eLoJog9b+CaM2HO4fSOm69MV4hZiOVwrucELmzDIXtbGKkzzR3a6F CtynDT0x66aYgNj+rjJ0NDa8KSkEv6tnWnbZMuP53j0o6ghNlK/56Y64jpfZ/TSscY4L +5VhdgxEgvzZqh2ckqmhtL320219HIk2hf09svwomHfmKi8WykgIxUK1TQPLECiU+Nsv zseg== 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 f45si2025728eda.345.2019.10.09.12.11.31; Wed, 09 Oct 2019 12:11:31 -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 S1732006AbfJITLZ (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:25 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:44083 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731824AbfJITLR (ORCPT ); Wed, 9 Oct 2019 15:11:17 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MofLl-1hleRf0kjR-00p7Pi; Wed, 09 Oct 2019 21:11:14 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Takashi Iwai Subject: [PATCH v6 21/43] compat_ioctl: remove translation for sound ioctls Date: Wed, 9 Oct 2019 21:10:21 +0200 Message-Id: <20191009191044.308087-21-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:IjOtPhS8f/wctkUCtdYhjt7Oobw/bwEov9yhKM7+na17h4VN3JY gHmnOdMMLWjyuU7D6VPosBnNWLPq7nXGG9bXUk6Plla5DGQF81+XJiO7L1ul+HwDru5U88L RpKV3fkf4cUUJHNguxV5eXXp6erDfNMmWkk+m7+SzyqMpbmkp2uAaDMuWdneItXf54mg9vC sof4kXQMLKDcRwTG1z5yw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:izuHaP1RMuY=:rY1acgga02r/4hQ03pOWbC vuMdpAdZ0fiJimHzsRIX18ujsrTb1Ns+o6Rp1tWpNI0pZUmyuiQKt/iCA29DW7GqVPzlBk8Qx KVTLCBz5tXWw5zPHuxpMCIkSA/7T0tIVlV7zp7auLxYJsEYxwnJ7KlvfoCx33oE9vw4trvJza MRMqphsYGu/rshDNHJN6f+prC4kahnhputnjp3fM5wp1xYwte6iSMfMh9oETZFLYwCDtxwQHw Tbtfgdt1nm/F5rssDWIL5XaDPEp+jFj82vHHKDT69pccJrt4JhFsTD7a/bC0rT3ihkknM7EXr OR0HGRVe+9COtsaUTTL52ESgwOrxlzt7vmtl29RY/tJ8K1hHiSFTdyPaW5G3JdT6NZXp/mTcu kqCqNEF1ln8YNyRAf5sGjm0MQYJzm5w4lZ8Z4Lmim7UJUVGhWIsa/8UztbhSD8zvJGlYAyhV6 PS5jKOBpZ4vv0d6YtQg0lbwCWg6ZRxPgPW5x4/d0bRAhGviHo+UM5tKQIpNHHdm05ki81RpWT WPrmejWjUrJ/KmrM+fXlb872eg3aB45pyJ/Vo7AGfzyetrPErYLBLvgllS1mbf2oK306FHoOz czzbF9s480+PZAVrug2cpBAy89/NojNGzXlI+c/GiaRXdzGOJw3y/fAQ00LrGzp2EKSjhtvSn Kup0suciTeg3whBm4YFcZvCh9kvLOla960H/u1oPrvrcrIt2MoOQE5H0AQ5Jyquf9b3pk7c9N wDm1f8YhADCZgc3le6YFTLuxG0T2SCe+OHDKRaMohB2g8v1CLChoHm+pkUtECczjdUaJg8GCF WffxTV5EbZarbrNdwzcuYbq7iWxuuQKpJLoR0V3/NcKKHkn8f8HQQdxsjWeVgTNwB8+OZsAra iMFR5b0QPzntxUhUhQuQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SNDCTL_* and SOUND_* commands are the old OSS user interface. I checked all the sound ioctl commands listed in fs/compat_ioctl.c to see if we still need the translation handlers. Here is what I found: - sound/oss/ is (almost) gone from the kernel, this is what actually needed all the translations - The ALSA emulation for OSS correctly handles all compat_ioctl commands already. - sound/oss/dmasound/ is the last holdout of the original OSS code, this is only used on arch/m68k, which has no 64-bit mode and hence needs no compat handlers - arch/um/drivers/hostaudio_kern.c may run in 64-bit mode with 32-bit x86 user space underneath it. This rare corner case is the only one that still needs the compat handlers. By adding a simple redirect of .compat_ioctl to .unlocked_ioctl in the UML driver, we can remove all the COMPATIBLE_IOCTL() annotations without a change in functionality. For completeness, I'm adding the same thing to the dmasound file, knowing that it makes no difference. The compat_ioctl list contains one comment about SNDCTL_DSP_MAPINBUF and SNDCTL_DSP_MAPOUTBUF, which actually would need a translation handler if implemented. However, the native implementation just returns -EINVAL, so we don't care. Reviewed-by: Takashi Iwai Signed-off-by: Arnd Bergmann --- arch/um/drivers/hostaudio_kern.c | 1 + fs/compat_ioctl.c | 158 ----------------------------- sound/core/oss/pcm_oss.c | 4 + sound/oss/dmasound/dmasound_core.c | 2 + 4 files changed, 7 insertions(+), 158 deletions(-) -- 2.20.0 diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c index bf75b1ceac47..d35d3f305a31 100644 --- a/arch/um/drivers/hostaudio_kern.c +++ b/arch/um/drivers/hostaudio_kern.c @@ -298,6 +298,7 @@ static const struct file_operations hostaudio_fops = { .write = hostaudio_write, .poll = hostaudio_poll, .unlocked_ioctl = hostaudio_ioctl, + .compat_ioctl = compat_ptr_ioctl, .mmap = NULL, .open = hostaudio_open, .release = hostaudio_release, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 03da7934a351..33f732979f45 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -51,8 +51,6 @@ #include #include -#include - #include @@ -458,162 +456,6 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN) COMPATIBLE_IOCTL(PPPIOCATTCHAN) COMPATIBLE_IOCTL(PPPIOCGCHAN) COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) -/* Big A */ -/* sparc only */ -/* Big Q for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_SEQ_RESET) -COMPATIBLE_IOCTL(SNDCTL_SEQ_SYNC) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_INFO) -COMPATIBLE_IOCTL(SNDCTL_SEQ_CTRLRATE) -COMPATIBLE_IOCTL(SNDCTL_SEQ_GETOUTCOUNT) -COMPATIBLE_IOCTL(SNDCTL_SEQ_GETINCOUNT) -COMPATIBLE_IOCTL(SNDCTL_SEQ_PERCMODE) -COMPATIBLE_IOCTL(SNDCTL_FM_LOAD_INSTR) -COMPATIBLE_IOCTL(SNDCTL_SEQ_TESTMIDI) -COMPATIBLE_IOCTL(SNDCTL_SEQ_RESETSAMPLES) -COMPATIBLE_IOCTL(SNDCTL_SEQ_NRSYNTHS) -COMPATIBLE_IOCTL(SNDCTL_SEQ_NRMIDIS) -COMPATIBLE_IOCTL(SNDCTL_MIDI_INFO) -COMPATIBLE_IOCTL(SNDCTL_SEQ_THRESHOLD) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_MEMAVL) -COMPATIBLE_IOCTL(SNDCTL_FM_4OP_ENABLE) -COMPATIBLE_IOCTL(SNDCTL_SEQ_PANIC) -COMPATIBLE_IOCTL(SNDCTL_SEQ_OUTOFBAND) -COMPATIBLE_IOCTL(SNDCTL_SEQ_GETTIME) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_ID) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_CONTROL) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_REMOVESAMPLE) -/* Big T for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_TMR_TIMEBASE) -COMPATIBLE_IOCTL(SNDCTL_TMR_START) -COMPATIBLE_IOCTL(SNDCTL_TMR_STOP) -COMPATIBLE_IOCTL(SNDCTL_TMR_CONTINUE) -COMPATIBLE_IOCTL(SNDCTL_TMR_TEMPO) -COMPATIBLE_IOCTL(SNDCTL_TMR_SOURCE) -COMPATIBLE_IOCTL(SNDCTL_TMR_METRONOME) -COMPATIBLE_IOCTL(SNDCTL_TMR_SELECT) -/* Little m for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_MIDI_PRETIME) -COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUMODE) -COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUCMD) -/* Big P for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_DSP_RESET) -COMPATIBLE_IOCTL(SNDCTL_DSP_SYNC) -COMPATIBLE_IOCTL(SNDCTL_DSP_SPEED) -COMPATIBLE_IOCTL(SNDCTL_DSP_STEREO) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETBLKSIZE) -COMPATIBLE_IOCTL(SNDCTL_DSP_CHANNELS) -COMPATIBLE_IOCTL(SOUND_PCM_WRITE_FILTER) -COMPATIBLE_IOCTL(SNDCTL_DSP_POST) -COMPATIBLE_IOCTL(SNDCTL_DSP_SUBDIVIDE) -COMPATIBLE_IOCTL(SNDCTL_DSP_SETFRAGMENT) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETFMTS) -COMPATIBLE_IOCTL(SNDCTL_DSP_SETFMT) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETOSPACE) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETISPACE) -COMPATIBLE_IOCTL(SNDCTL_DSP_NONBLOCK) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETCAPS) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETTRIGGER) -COMPATIBLE_IOCTL(SNDCTL_DSP_SETTRIGGER) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETIPTR) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETOPTR) -/* SNDCTL_DSP_MAPINBUF, XXX needs translation */ -/* SNDCTL_DSP_MAPOUTBUF, XXX needs translation */ -COMPATIBLE_IOCTL(SNDCTL_DSP_SETSYNCRO) -COMPATIBLE_IOCTL(SNDCTL_DSP_SETDUPLEX) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETODELAY) -COMPATIBLE_IOCTL(SNDCTL_DSP_PROFILE) -COMPATIBLE_IOCTL(SOUND_PCM_READ_RATE) -COMPATIBLE_IOCTL(SOUND_PCM_READ_CHANNELS) -COMPATIBLE_IOCTL(SOUND_PCM_READ_BITS) -COMPATIBLE_IOCTL(SOUND_PCM_READ_FILTER) -/* Big C for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_COPR_RESET) -COMPATIBLE_IOCTL(SNDCTL_COPR_LOAD) -COMPATIBLE_IOCTL(SNDCTL_COPR_RDATA) -COMPATIBLE_IOCTL(SNDCTL_COPR_RCODE) -COMPATIBLE_IOCTL(SNDCTL_COPR_WDATA) -COMPATIBLE_IOCTL(SNDCTL_COPR_WCODE) -COMPATIBLE_IOCTL(SNDCTL_COPR_RUN) -COMPATIBLE_IOCTL(SNDCTL_COPR_HALT) -COMPATIBLE_IOCTL(SNDCTL_COPR_SENDMSG) -COMPATIBLE_IOCTL(SNDCTL_COPR_RCVMSG) -/* Big M for sound/OSS */ -COMPATIBLE_IOCTL(SOUND_MIXER_READ_VOLUME) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_BASS) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_TREBLE) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_SYNTH) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_PCM) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_SPEAKER) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_MIC) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_CD) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_IMIX) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_ALTPCM) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECLEV) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_IGAIN) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_OGAIN) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE1) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE2) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE3) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL1)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL2)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL3)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEIN)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEOUT)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_VIDEO)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_RADIO)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_MONITOR)) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_MUTE) -/* SOUND_MIXER_READ_ENHANCE, same value as READ_MUTE */ -/* SOUND_MIXER_READ_LOUD, same value as READ_MUTE */ -COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECSRC) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_DEVMASK) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECMASK) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_STEREODEVS) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_CAPS) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_VOLUME) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_BASS) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_TREBLE) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SYNTH) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_PCM) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SPEAKER) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MIC) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_CD) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IMIX) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_ALTPCM) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECLEV) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IGAIN) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_OGAIN) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE1) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE2) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE3) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL1)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL2)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL3)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEIN)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEOUT)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_VIDEO)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_RADIO)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_MONITOR)) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MUTE) -/* SOUND_MIXER_WRITE_ENHANCE, same value as WRITE_MUTE */ -/* SOUND_MIXER_WRITE_LOUD, same value as WRITE_MUTE */ -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECSRC) -COMPATIBLE_IOCTL(SOUND_MIXER_INFO) -COMPATIBLE_IOCTL(SOUND_OLD_MIXER_INFO) -COMPATIBLE_IOCTL(SOUND_MIXER_ACCESS) -COMPATIBLE_IOCTL(SOUND_MIXER_AGC) -COMPATIBLE_IOCTL(SOUND_MIXER_3DSE) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE1) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE2) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE3) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE4) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5) -COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS) -COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS) -COMPATIBLE_IOCTL(OSS_GETVERSION) /* Raw devices */ COMPATIBLE_IOCTL(RAW_SETBIND) COMPATIBLE_IOCTL(RAW_GETBIND) diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index f57c610d7523..13db77771f0f 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2717,6 +2717,10 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long static long snd_pcm_oss_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) { + /* + * Everything is compatbile except SNDCTL_DSP_MAPINBUF/SNDCTL_DSP_MAPOUTBUF, + * which are not implemented for the native case either + */ return snd_pcm_oss_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); } #else diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index fc9bcd47d6a4..f802ea331e24 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c @@ -384,6 +384,7 @@ static const struct file_operations mixer_fops = .owner = THIS_MODULE, .llseek = no_llseek, .unlocked_ioctl = mixer_unlocked_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = mixer_open, .release = mixer_release, }; @@ -1167,6 +1168,7 @@ static const struct file_operations sq_fops = .write = sq_write, .poll = sq_poll, .unlocked_ioctl = sq_unlocked_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = sq_open, .release = sq_release, }; From patchwork Wed Oct 9 19:10:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175670 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1174756ill; Wed, 9 Oct 2019 12:14:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPCQGsSoWyG7G4aXaAOqUaoF+msTZ1razoJyQ8pW7gWvYTRMB1XaJ+V+Ef4AvmaJPw6lXL X-Received: by 2002:a50:ec0f:: with SMTP id g15mr4513532edr.59.1570648490700; Wed, 09 Oct 2019 12:14:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648490; cv=none; d=google.com; s=arc-20160816; b=ikiVjUYWMN8u4eRzoodFzQQzvJV7dunlVXBTRRUIrHW0scfGRIqdcxm5uU9uO9whsf fx8wqDycqGTgabANZxnZbVO4Ozq+Lam8Rw58Yf7kWxVxcqvToqKZABT+klpOkVW/FkFj zF2xL7Qyc7eN7N3cJNPaTKVkGL6iJrnmWjYbxAzH2Nd1LZ5Zt51+zVj5U/Od3F00cEzP ruEDKsVYwdRUQ7chKKpguJvwipO+4mG19tERF7er6J9Qb2+CkTn5twUkRCQwnMxTPflO 22TXYveEFEuAhzmRvpeORDOwJyiv09kEashJayklvOs0vXY3glMJ+irsa2c/wNJx2h7r 8TSQ== 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=tqWJpngsbeOUOvI+PUtHJiLs8waTy4JAQYhX2yRItVA=; b=P4AHnBxCnONv9X9alwwB5Ch2GsL70ag8IWulrRghhY0hnLXCc+2C3RZCRzoKnvDNdU 83CV0dvdxKtGBIbuILdst1KbNsExJexJK/y3k/miVz0jNQWMKOWUjjDHfOcIICgNOPqB UGelIRqYZrjQJyeQp5eJKXt82HC0YLHJk4c/0QllNoT5+gDnH6Gdc3lXtqxYCJ3DmP/3 MgKKu+rX5a0Bevnti8xe8ZxYhLEbDCPhe7a/p1p6+unxc87RShvpWFnSPayOWWESwZwL BTdswKFC4QjBoNyB5UrJrnMMPbaXXimlIDyYkI5tp6RfwMQzmeEh9JVguZNN/5HPJK06 7H5w== 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 e22si2005231eda.300.2019.10.09.12.14.50; Wed, 09 Oct 2019 12:14:50 -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 S1732552AbfJITOr (ORCPT + 26 others); Wed, 9 Oct 2019 15:14:47 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:59773 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731804AbfJITLP (ORCPT ); Wed, 9 Oct 2019 15:11:15 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MacjC-1hgTm41Y0A-00cAyD; Wed, 09 Oct 2019 21:11:14 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 22/43] compat_ioctl: remove IGNORE_IOCTL() Date: Wed, 9 Oct 2019 21:10:22 +0200 Message-Id: <20191009191044.308087-22-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:4ibtuu83t8J3I3nx9gtJjn6IFOwAlacfixwPLywJPqpQL/tXpS1 FygjVs+7RNbo33Hl3Ps7NIL+XmxrAfbBfr+6JPmj1fbg2SfZnhDI6em5cdEoaCCHzg8C4Kb d7bNfYn5lk4T7ZnfkBPkWIGQMefp3eoztuKlhWglncgAtQr3gGD3qoILQFO1sZN9Q05kd1b ih6cVAqbzYsltwW0OpZ3w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:AcH8bIy42IU=:Mdqu1BVs/UAgPHhPWIU1fg xfeL1NPaBTP8tG0CaCM/etZWHcZFyqZ/JcvGFiXZQFXAqbuVKR3JuwMi2FKFfMSehbIQBshL5 KeMkOFWYNR//Kb1gxf3/CoMzWtkQ7lxoT2FMiqiDRKOjGdW6Efh6IIXN9HOr7vOdGChqpWj2e fB/4+tj51O15u5zdmWSLY1id+RBNWkH3+rWtQt/UeOj7yFWxycB/HCACK0/Xej90uH6cNCdXb zmXhXwDLgZ0LZVH8GHO5siybAXh5SGZJ1wuCSBfnjxmALzOJAd1d7wBilIHT6MpoU4u0Ly8kz iHHSKluTiEbv0j+DBC8jvr2fxY99oCPzH1PEoqP/ci/5IyyLSBuQH3HftjVDxsD2XBeDPtEh0 LHrhYaykEhpmZMklBDd/x8e4kcW1/0ZWQmRHrIVpA8q2r4BxeBL2egnOqJ8Hrh+Id7q3/+oHu Z9VGaAA3BqBoLT06xEjqjkREQaTtjVdd+isHMTbjCG8kl2P2Gox7Oo2w4gIBWZcZRPt4iJD3o /4FaxRBnOKYhkP5pCfJQbukqRZ1A3c095UeMe5/rk9s/uHNlbAW0AhSeXaTXVL8DdVLQ0l4eb jKXcwEPK+RsGPlj8Uj4nLmUJAxxzO7YuqHiF6KZ3DSjycA2xVM3/b/aL60224KS+VySLka3m8 ScCgugnwewPeLD4n+S9sbU3gBQJGcw6fK7oIbNoqAiQ1q1hJAPU7BX0taqkpvBCtPxUwoOaCM ZiszSJxrqe1Rk60LNiScbulAusAlnKaXXTg2gjYcWm8ubKESDgZW60+tWUbS0otMtf+ujF4Pe xklC2Cjmlz0iE+D03CPf0s014ailuTfCTMuvbrArcH7d//4ao6BM0qmv5eiqc6tnasN4JaXsq meTGtpVPr9ivOZDUjojg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit 07d106d0a33d ("vfs: fix up ENOIOCTLCMD error handling"), we don't warn about unhandled compat-ioctl command code any more, but just return the same error that a native file descriptor returns when there is no handler. This means the IGNORE_IOCTL() annotations are completely useless and can all be removed. TIOCSTART/TIOCSTOP and KDGHWCLK/KDSHWCLK fall into the same category, but for some reason were listed as COMPATIBLE_IOCTL(). Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 56 ----------------------------------------------- 1 file changed, 56 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 33f732979f45..10dfe4d80bbd 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -56,11 +56,6 @@ #include -#ifdef CONFIG_SPARC -#include -#include -#endif - #define convert_in_user(srcptr, dstptr) \ ({ \ typeof(*srcptr) val; \ @@ -358,17 +353,7 @@ static int ppp_scompress(struct file *file, unsigned int cmd, #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff) #define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd), -/* ioctl should not be warned about even if it's not implemented. - Valid reasons to use this: - - It is implemented with ->compat_ioctl on some device, but programs - call it on others too. - - The ioctl is not implemented in the native kernel, but programs - call it commonly anyways. - Most other reasons are not valid. */ -#define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd) - static unsigned int ioctl_pointer[] = { -/* compatible ioctls first */ /* Little t */ COMPATIBLE_IOCTL(TIOCOUTQ) /* 'X' - originally XFS but some now in the VFS */ @@ -384,23 +369,7 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND) COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST) COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) #endif -/* Big V (don't complain on serial console) */ -IGNORE_IOCTL(VT_OPENQRY) -IGNORE_IOCTL(VT_GETMODE) -/* - * These two are only for the sbus rtc driver, but - * hwclock tries them on every rtc device first when - * running on sparc. On other architectures the entries - * are useless but harmless. - */ -COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ -COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ #ifdef CONFIG_BLOCK -/* md calls this on random blockdevs */ -IGNORE_IOCTL(RAID_VERSION) -/* qemu/qemu-img might call these two on plain files for probing */ -IGNORE_IOCTL(CDROM_DRIVE_STATUS) -IGNORE_IOCTL(FDGETPRM32) /* SG stuff */ COMPATIBLE_IOCTL(SG_SET_TIMEOUT) COMPATIBLE_IOCTL(SG_GET_TIMEOUT) @@ -487,31 +456,6 @@ COMPATIBLE_IOCTL(JSIOCGVERSION) COMPATIBLE_IOCTL(JSIOCGAXES) COMPATIBLE_IOCTL(JSIOCGBUTTONS) COMPATIBLE_IOCTL(JSIOCGNAME(0)) - -/* fat 'r' ioctls. These are handled by fat with ->compat_ioctl, - but we don't want warnings on other file systems. So declare - them as compatible here. */ -#define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2]) -#define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2]) - -IGNORE_IOCTL(VFAT_IOCTL_READDIR_BOTH32) -IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32) - -#ifdef CONFIG_SPARC -/* Sparc framebuffers, handled in sbusfb_compat_ioctl() */ -IGNORE_IOCTL(FBIOGTYPE) -IGNORE_IOCTL(FBIOSATTR) -IGNORE_IOCTL(FBIOGATTR) -IGNORE_IOCTL(FBIOSVIDEO) -IGNORE_IOCTL(FBIOGVIDEO) -IGNORE_IOCTL(FBIOSCURPOS) -IGNORE_IOCTL(FBIOGCURPOS) -IGNORE_IOCTL(FBIOGCURMAX) -IGNORE_IOCTL(FBIOPUTCMAP32) -IGNORE_IOCTL(FBIOGETCMAP32) -IGNORE_IOCTL(FBIOSCURSOR32) -IGNORE_IOCTL(FBIOGCURSOR32) -#endif }; /* From patchwork Wed Oct 9 19:10:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175668 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1174510ill; Wed, 9 Oct 2019 12:14:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfIQLkJgA1/vRDpGVADTr3ggJ87gUlJIXuO0U3No8WsQoEkoxoM1yDSXjxbD6bwvxLIewM X-Received: by 2002:a17:906:8315:: with SMTP id j21mr4455209ejx.244.1570648475835; Wed, 09 Oct 2019 12:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648475; cv=none; d=google.com; s=arc-20160816; b=JxCLBlrsnHlN3dF1X4rryQuKM3g6kvjWrthcH7Go4o755KNZp4HdVCfKwSEa0Mxzx1 caTwot+4MJ5m1VMDNdmuF2q1NJetyE+jkUC3hROP2H5/gRLDtgE39n2Uzms4kyh86ZWZ BqIX33QAiv2bEp8F6Y4ekmHH7OanuHPrHMh2azHOsOPEowYgIJGtD6Hi6tqSgAY96xto x23olbeICuHewgyjKVL49Ta42qR8DLt8ivvYIBj4sH+LKSLG3yB2TSvrps9sfQlaX/1e FJt7lg5Qvuvli30YUYhoZIBXJiJfLlYnsbytw6FMNXJkMdN8ErbUqNtqVCaFUp+yEVdX kJLA== 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=ihablNMJXNTLuTKbXfL3FYp092/wGJrqBFoQwk/BFjg=; b=yb9PzCaA2QnwWp21yfeJimXeaM36krYaNBK8giyZ0wTCnqNA57nKbDcNyMMmSX99R+ RfaJ83rgxcTX/gfn3KGAvgeGJUKqsN3iZR5s1jbkFExAJZlsWVs8hX7Rp5eIcgo46uxZ qPJSKeHyC3DL6ZTtsURZiEAIwcdyRL49mYIRI9INYsrm+FyikTvGTU9oVZb7w3XYUtxr vCfIMFQVhgJdhLlHSGXvLEw8XT7GuIA7slyBCjDQweyIdnUJTAG7nzIry8BvAr+v9Dq/ AC7Dfwxv75nckfcatd/Pslsne1IxadCu6dAheGk2batwnmkafJQCt5VOGqPtfCvQD+Xf M4Fg== 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 j12si1672315ejx.282.2019.10.09.12.14.35; Wed, 09 Oct 2019 12:14:35 -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 S1732524AbfJITOd (ORCPT + 26 others); Wed, 9 Oct 2019 15:14:33 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:48645 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731827AbfJITLQ (ORCPT ); Wed, 9 Oct 2019 15:11:16 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MUY9w-1iiiBO2Rnc-00QSut; Wed, 09 Oct 2019 21:11:14 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH v6 23/43] compat_ioctl: remove /dev/random commands Date: Wed, 9 Oct 2019 21:10:23 +0200 Message-Id: <20191009191044.308087-23-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ch73ytSgkS4oO2S41UnNXUn/KSJkmlRmqTVkiyababZ9lcd2HmZ l18W6SmPMr4W7U9DWKyd3pxDD1nj9yEj1Ou4wqNRLKtzbDLLCXdXpAoeBb1eYQODVbRCd25 7kh75HGXTVxdLptZI8IsTTBoPfgxqkZx/APabZcPCZimckfmVFsY7EwOgC2AuzpQimd9Pzv iGnWmE0DSKNq074mPIXiQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Mp88p1QWiEE=:vZ9uVfiRDQJSgHqzjVRZzC BLZy+JtpG647XofXSYFHsX58YjMhiQy0tlW9NM2tYEjhWuHmmFUNEGNFEb0IXxI0xS9gZCsLC dTYqJ+6UktTYxrBJz6hprK++ur0WUla5FN6ejzfosIH4SGGpaE5qOxB937769UxopXr+jRqeZ +HgZ+pYPJ9MqrccH28mt5dVlVQJN5nDef0horNZ5Cn5JGQPTy8oBqzaLZp8vkgbrqOojs4/bx XRpswMQDTVp0+ohB82I7JbcIAzk2o1KHYyZ/qsWOwJz9Rzt65fd1GdHN1sm1vnY6A6DEv9F+U Vm80fKI8uSDF7hd+TUdZOQh9bMLvon9DTrQyEvVznhN0rgXfZiAy7Di8M2bnv0O2cytW6UhPI p14zadmbezGpIQSYg4yJJlyMMob8QkE3eZNlQyRJXvprX19Y8LiwbRatlZwN13GqDt4eFGfsB SMMi5u0/zmyK0r5c9B5ZjWoxTr+lKqFHZnvSRmN2m+gxGD/yApL8t5wy9QMIKGwqFvbO+MSU0 GMPrFqGhiByU8cl+x4jiS2fTXS1C+WfSBmMMCkDz1ivvO+CbMVOYBbhdMdDh1GXxLuADVb+yP hOV3v7t/WLNHAAGVEoGs/71LHQjOqOUOnyNte6npQvWkNFf5lx6qf3EHOBSLuTOCokg3OSTX5 dlqto6yy8strq2ogrPAoj9rSYmd2Ld3BlqXu6VHBsj6+r1wJgDHKF5BaGG6CP+LlkrH9VIT+g z3MuEy3tSsAiZOJ1A2PExwAfl+q041oJkdcbkl+fQ8OH+5SkoPG4fLwl5sCdhSXTrzOnZp6Mk WHIbNwY3Xl7IEht+6Q1OCvj7AJrDRWmZPBviXYXm99FxtTxtiBnh0EyVXbNOeUNqbcpVHAwr/ RetjiPXaFCl2b+MblZIw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These are all handled by the random driver, so instead of listing each ioctl, we can use the generic compat_ptr_ioctl() helper. Acked-by: Greg Kroah-Hartman Signed-off-by: Arnd Bergmann --- drivers/char/random.c | 1 + fs/compat_ioctl.c | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) -- 2.20.0 diff --git a/drivers/char/random.c b/drivers/char/random.c index de434feb873a..46afd14facb7 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -2167,6 +2167,7 @@ const struct file_operations random_fops = { .write = random_write, .poll = random_poll, .unlocked_ioctl = random_ioctl, + .compat_ioctl = compat_ptr_ioctl, .fasync = random_fasync, .llseek = noop_llseek, }; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 10dfe4d80bbd..398268604ab7 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -439,13 +439,6 @@ COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT) COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT) COMPATIBLE_IOCTL(WDIOC_SETPRETIMEOUT) COMPATIBLE_IOCTL(WDIOC_GETPRETIMEOUT) -/* Big R */ -COMPATIBLE_IOCTL(RNDGETENTCNT) -COMPATIBLE_IOCTL(RNDADDTOENTCNT) -COMPATIBLE_IOCTL(RNDGETPOOL) -COMPATIBLE_IOCTL(RNDADDENTROPY) -COMPATIBLE_IOCTL(RNDZAPENTCNT) -COMPATIBLE_IOCTL(RNDCLEARPOOL) /* Misc. */ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) From patchwork Wed Oct 9 19:10:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175639 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1170666ill; Wed, 9 Oct 2019 12:11:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6rqZg7qUTMpcOeQZDB94HyiG93fvCG4uADumbuF1O9R+Q9w6F0GlTdZRJZciAfj/97lr/ X-Received: by 2002:a50:f296:: with SMTP id f22mr4457341edm.69.1570648284140; Wed, 09 Oct 2019 12:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648284; cv=none; d=google.com; s=arc-20160816; b=JGktsKFO0Zr342w9a/qb8lLkcFUrACkQSaahA2LkbbO3Tq+CF4pb7M7OE/ITfPPpON jVhocp8zU3hOkkMpwVhYykq18z2B2dc4cKkyOKIyjCDP+VsBPfbVl11dreSzOYIx9MdD O/yXna0efXcSDmNrupTBLqIMs+Tyt1DyuZvSm2VNPNHKoWkN/0XcTGArqLjX8P5J9bV1 huFOJEQukeRDKZop0txc0ymzTHrB5p52eBf+2n3YPdiDUdLNqYMZm2LEjmKzTSqW8H4r duUj7X5qmGHAMrBRn/BdjsjPKx+LkpCFE41SG9fqFVpoy7XhSybY9THqdDupTgh1wlbh 4DHg== 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=ZewCud2QjiLPZaWTQ7rbzKAFJuuwnqAlXK2hPH97xuo=; b=IhpgLWbbpO/p8ORbbmc16EgUsQy16f+ff+JPniLqQwZV9ME5ObLo3dUlQ0q37sCqqL UkUh2uxTf4MgxrbTB0yNtTN7apHQjmHlQsGOBK0dwbDi3UFLksqhMDAeFpePrlNKq5EA lK8W1zdu8BGM465f6ttRHTfmE4PyTzz73nKPxjIMSABch5LG7tglw/4YIOBWGM0FiVUj ztNNKIkPsEE+cC7tgPb7gNIM7aBKs4YPfcRdyPG9SnPn4LEQfXptXonmi40dytT4U71i B/GPB8wW650KfrntJ968pciIK268QW/ZSClDMnOew8HL7QeeZ97N/dn7+EKhcuGtRkGz rShg== 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 g30si1996732eda.2.2019.10.09.12.11.23; Wed, 09 Oct 2019 12:11:24 -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 S1731985AbfJITLX (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:23 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:33525 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731839AbfJITLQ (ORCPT ); Wed, 9 Oct 2019 15:11:16 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MUY9w-1iiiBO3dmy-00QSut; Wed, 09 Oct 2019 21:11:14 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , linux-input@vger.kernel.org, Dmitry Torokhov Subject: [PATCH v6 24/43] compat_ioctl: remove joystick ioctl translation Date: Wed, 9 Oct 2019 21:10:24 +0200 Message-Id: <20191009191044.308087-24-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:x2cKbCWiwvtTu0Qle1GTAXaofujFu4TqPOSrzfs49dxShM/dHOg AM8+FdkHPUNbbcajz9XAKdK/00jXiMqsA7QxZ7e5Elfsjj/JgJHiRfQpUiydME6xnaHzZFE DICT07/ckpbdTm8x6zSAJ7ENEf5ADRKW4Hzfzb0uCmZhtzEFqUgBNACJf1folSnv14Ykzwa uLzFp/WEybLIr+pcSNFzg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:3WaeOwFJhJc=:nuObE3Ol7NblOV2/MWCAkC xS4Mgc2fhrU4MUe0GtkE61H5snv7FwEBJsrBMARTxrQ1txWFb5+jhksnjxb9pzXvgtHYoXm3C yH+bOdbsD7kqWzFzzeHZZaKlKuWtx2HuWP0mhVvTgQGuVY4TSSjleq20X6bZOfOU9opdffRir T8/drHeM1JKBUMfsM5iT/JMrtmappIQ2kUea89pFUNVRTDplxOZqdQZYbbEttsejmtLL9f20B h4cegT7gWt0L2WfK1d4VrXqU+ITwBYdNh8VVVCV2Wzk6seGnEzdZgt0Oym8AUP0ShNLv9gMid ACCVpUU89VV3h6sT+mAQ8WfWq4mHBvnVMfojL9NiQvN8E8k6f0PTp9BnIh38xCxiLy/hy9y2e ABmCVY/m7tMwgyTm57UAg514liHZ45SAxnJxu3Vt/3iwrS4dyDiPofBKlWxuVi8C+S7KSIw6y RzL4L6lyQnIvBvMvvlZjXC0FJo5a99j43r2IT88DkGIyvCI57Li2+hCrPg/Dg1E7gtk4sQnnF zYQzkOylD9/IosZV4QxXgS3CQic3e68j23wUHvyd8CbfL0t8MeNB869d9q4jYKBQz74tOpRkv tUHX+uvgRdTG/d3csFoFAUT2DYOuKUyru+Y/52KOXJZsZZLB6OKJF4nwnZWjVTANxC1UG6rFR D+vPkiBVz2icsVJiyw9H6qpoQtvwmMmTzAR84wY6yWhp9v+uTI5ibhcdi1QzQasynrsAmMRx7 JSG7gnWJLTjuBSNfEGz/qAzZ9meKQeivQi18CLzyv5q4zMQ9PXsM4iL7oGbT8jgUuWrCPfbFf Flp1lEd5dd4RKIkV2cBqTDt62t4eYcrFaQez+alalTIGHvZSOxOZGUiIoamsDeP8F0htoga76 uVLyPKoiSKplEYNIawfg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The joystick driver already handles these just fine, so the entries in the table are not needed any more. Cc: linux-input@vger.kernel.org Cc: Dmitry Torokhov Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 7 ------- 1 file changed, 7 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 398268604ab7..a214ae052596 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -11,8 +11,6 @@ * ioctls. */ -#include - #include #include #include @@ -444,11 +442,6 @@ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) -/* joystick */ -COMPATIBLE_IOCTL(JSIOCGVERSION) -COMPATIBLE_IOCTL(JSIOCGAXES) -COMPATIBLE_IOCTL(JSIOCGBUTTONS) -COMPATIBLE_IOCTL(JSIOCGNAME(0)) }; /* From patchwork Wed Oct 9 19:10:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175666 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1174150ill; Wed, 9 Oct 2019 12:14:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFjheNUsnP35NJEcVZHzliMYyRbpmYch5DthilMo7H+X2aABiynrry+L38HUrF6gTodqEO X-Received: by 2002:aa7:c513:: with SMTP id o19mr4397829edq.75.1570648456933; Wed, 09 Oct 2019 12:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648456; cv=none; d=google.com; s=arc-20160816; b=g2gcu9V88Ej8Yg54Ak1hmOMQB+DPcuTx5+5BWMkC5UsyREZJrVYCBfs0thc3qsj09c g3+o12y6qBNzGHxdPMU6kQxZw0ei7O69SOyBqSGF401xo3tbeYfO7yNNIZBIJ+Eg2bGp eOB+axGUyaxKQuUJOw3fGHiN6ywky3F2SFsemddabUkXw8Op0fD27k6pjIlWyqYcNa6g F/CFfhctJzqGJc2vCSsPouK1SBw5oD8hXYFxu4FKsPoUzHQ6JXp9gm8uVgBHfSa3pZet qg9FFyN4swB/PDFPPGSWIVvipfb55x4LONNs57ghpYOTUlKRI89tmy6BB3Li02vD4JoI ROUw== 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=lctEys/zY55LbjmaJVXgneAxpHqTL1pa/nKPa0p06GU=; b=VH4Vf6iePFEqzStLuNBiUkku7adwcoz1F0CSHBxgP3iIdBqA8xLVQ5c0BShgThpLzf l0zUsA0eI3NTsFYwICiIVvtejo+ZwM8LL2+G81+2PNSff3DRCkX33CDQFrb9uHs0oql1 AHjkU10kTKfl4rPAXLPINOoLYA5lZN1rbiv3bZWzlnJej4IdBprRqvJ6ij6mTM4+V6TI uWO6xmbCmnmfKhaXC/tyx38nixM4SnSetL/qYJPjWCcHaV8uAvK2yM/mS4+YXJfPLr8J +WoGRX7s6zoFiIPpDcDdXABuifKTpWC9uyN8JGxGBm2WIJ6EuewEKjzgyZaaVQA3pu98 7deQ== 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 bt6si1951269edb.69.2019.10.09.12.14.16; Wed, 09 Oct 2019 12:14:16 -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 S1732502AbfJITON (ORCPT + 26 others); Wed, 9 Oct 2019 15:14:13 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:53061 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731879AbfJITLR (ORCPT ); Wed, 9 Oct 2019 15:11:17 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N79hs-1i1wmF0d9o-017TFD; Wed, 09 Oct 2019 21:11:15 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , linux-pci@vger.kernel.org, Bjorn Helgaas Subject: [PATCH v6 25/43] compat_ioctl: remove PCI ioctl translation Date: Wed, 9 Oct 2019 21:10:25 +0200 Message-Id: <20191009191044.308087-25-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:A90z5qH3xuPEjD4JyPp3z+Nx3vYUYPAv74/jTKDarhYH9Ubga2o tDJ31p/Pflrla1qflW4JN1R01F4hWVjTdt6qDXFL0I2ae/P3yovVK//bT2AumB4jhaSSdKw A71F5hj00vYezGngiMh1wCFtzXM+vvbd+4P/7g21owwJqvwf9Y49gbdpslFJaXX6cwa2o3o oM5Dkwev3RZHEndKV/5tw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:YVgb4nM+fyU=:/C0Cg3j3BiaQHBhgm5/Nbd 0SMKT/pjwKkle2mq4YCy2rrGNBhQJmWR8se4qCM0VVsz8u6Umtki/Qe9vQrV3RGFkLhCmrc5c yM8RoEk/D0n4ufbSHIs/RuS+tE0RFO0j+83bxqLiEcX3giTswTqGvZDbpUe7oi7EX2Don9AEL Djru6rVJdMBhCQjMTDyPcVXVEMkxnZdz17S/dQcqhk2NDP63iWsyXrXfZmky+O5J13ExugnI2 OHJsZM9EU6UlNkUfJ82a7BZiK1IH9+PdJBq5i/28yrd6mAmIpO+7KSWyJSt9TOsnh0dH74tfC 8fMszqsIkGoyn7W3zgSQcy0SoeTKBeJs4kKvFkmDhWdwwjtPxpAmyQ4wL/PVFd/WHEF8KSPLq 0+ISTd+Hhhtb83MyYskSQKdsCl10bQMdxsdxRwiUrGPx2mFMvjI7aCU+u9mHlYKm85CGskIy5 nNvP/E00n4D5vi5+F3ptIikIMMnLH81Xj2St74TkmvGlInjczcrzMi6A1Zln0KgtD/2a8SFcu SBMyI26LzXQJieDdVS2DP68GnYufiLa+eM46vwLchxDMBo6cOjPQfhV4eY5nNZdT7/lnebxrF QC3oXrax6wT1Y+QPRMN5ptZU8g6m8pGQRePYJX9pwdzL2Ge7GyqBBW4gSzpNqIDdd7c5cJkDL dJWwsQ7AhaxuLW2xBAH4eST8H3igq8mTppshQ9IGaQ8oXnWtrrDwE6k/EtwcB4DtRQfq1V9l3 pDQktmDDBzOyWwFxVgE2nsV0I+ioTBpkb+/qFipXzgnyf3lK16Xe5yfcynTL8dZwGKOL6Sg+y +gyUOzv3gbup4ML2aOCYgTVDKV0QPn1VZNvooe53S+HH5z8NXXyJAxnmmy4nMQnRSVgmVY1DV pQQGm/27Zf2dP8QMETgQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The /proc/pci/ implementation already handles these just fine, so the entries in the table are not needed any more. Cc: linux-pci@vger.kernel.org Cc: Bjorn Helgaas Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index a214ae052596..37f45644528a 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -437,11 +436,6 @@ COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT) COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT) COMPATIBLE_IOCTL(WDIOC_SETPRETIMEOUT) COMPATIBLE_IOCTL(WDIOC_GETPRETIMEOUT) -/* Misc. */ -COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) -COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) -COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) -COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) }; /* From patchwork Wed Oct 9 19:10:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175667 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1174401ill; Wed, 9 Oct 2019 12:14:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwN9fVurebH7CZF6ne1WiU4BxiwAwXHuV29VZqtbxAV/z8oCRWutgP/TTy/Z8/kYSPvUYbu X-Received: by 2002:a17:906:3946:: with SMTP id g6mr4342714eje.49.1570648469156; Wed, 09 Oct 2019 12:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648469; cv=none; d=google.com; s=arc-20160816; b=yrSGXk/vhMoiEZ3iTG95FcFTgKnxxPt+5xWzKf9zJfkkLd5xd8r0+1waMHIoXXdtdj 187Wlgx1UAzVtZyBV6Z/on/Y8dhxQniy+oReUBAKF3+sW9QNT4FmH9TK58qh3112sqwG sDv8AoDrfJuZN1N2/JpRlfdttxWlFhUddb8PFDeqUQn+8o2LiMg3jzQhrird8OfMbwxx eRo9GnuBCN61hDqWk4EVNVMKvvoee8HEtL5dkmu3+FaO0dtPcAxgOTitAwCWZ1aJnf8+ IeEHVSk/rtW/zllh6oEg8WarSKGyY8GMwuOqQrWXp2fPYoL8dQqLzRLBZfDHv6471r4k EbYg== 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=lKHScvvENlDnvRSEZFugtX43p3kKPqQ704l+YFX5JrQ=; b=vA6JvZTUQBSlVHkpAzVvzL2AiL7qB0NYKzNe3i8ORQidjqGL23xKyGm7u1HzNfas2o 4tO50fSZrZTRMlZru9Y3vRu1nYL5gr0srjyCGsjFRKYjFkdKukVp2rJNNdER+ml/EfDo kj2pTtSZMLd6vQNY6G6KoO1BxJp6Usv8jttkvorirE1X7KvMEKecLpNrP03w3yscEm0S otpZRpMpZvYSXtqVfAbk1XSJL2C1pxXA5MdDceMvuEY2IRS0J4QHWd90VtF6zhW8oCvI GIOlT7e2GH73klOqws4MG2ORDDxdTfTJSQD/QSaPsVrp95xF5oAU7m24rlawgrptouv9 YpVA== 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 j51si1984022ede.301.2019.10.09.12.14.28; Wed, 09 Oct 2019 12:14:29 -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 S1732145AbfJITO0 (ORCPT + 26 others); Wed, 9 Oct 2019 15:14:26 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:43013 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731864AbfJITLR (ORCPT ); Wed, 9 Oct 2019 15:11:17 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N8XgH-1i5Vg21fDl-014SRC; Wed, 09 Oct 2019 21:11:15 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 26/43] compat_ioctl: remove /dev/raw ioctl translation Date: Wed, 9 Oct 2019 21:10:26 +0200 Message-Id: <20191009191044.308087-26-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:HjmQR2MNOTNwefTsjwqXeNcWNZPnuTYPOOSVxTpgnh2+kWgBjbC 4PWuHL970NpwGIA5s3UWCPN1Omd5A64scatHOWaJ+7yyjqcPRPkZvWoDLJddAUMjHxd8TMe WXeF3ct/fl1bR1JpWgoDqTAkj+2/snW5MNxisE5FmgoJXqEydS2hZ5ttp6q4tQ2FOB5KwBS iHe3QAPY0UxkgO2/B2w3Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:45nQ4/dGAik=:DO1TvolxEo/1OP/A40PdOF /3xFLkn2AU8Jita6p/Bhi1wlqnFoQLKfjj7vn8n3Sdr7vYXkDth9RRRdpy0QCh3q1BXD+Lu2H UH2xEZYJPdWyqyG+ff9Q8sLDFpk3lU5dQKx/n3gIBEIKDCdhJCIfG0E02cpSZQzwfsBle4Xs7 3isDDA4le1OHK9nKSG4v9F5tK2XMZp8VqF1PjBSalkAnpMMCOqlJN2QxsJ7M11Nu+kRd4gie6 gEEWP4cIT1v3Lc4S6F/iirQPJ6wggrmbEon7ADjJvmA0C7eO01O069Jwu/ttz1F0IGiygNa4+ CjSyGVFpVS7+SE74O32iWZbfvJ3HDzUqR7BZp5Xpm7kzDxFhIyBfVizvTgDcmz5yM5X5GKp72 6JecmkvjiL/z4Ft8wqFiXGt3+Uk2uxpHtwBjS9nZSKstJyWVCzhbimk+0TkMrzYgLOcHt2oKm 7k+ybls+YG3uZpb32reCMFTGborhcTYoqm3oE8tsWGtwJnkdpm6yFxTfEwTHbemCyg6yw0mrj lZjnpwQTVYECKjjfivVB9kVXdC+voSk7hK1XfKDW5Y6hYXaQNR3PX5QPvO15IJNqlVclop3tu jm9gHon0bLnMTcSR7GOYzdqCeHnCya6MqUzfzvJCFQ8c2A+Era9YKNb848GZyRdvB+biQ1SPa ABMrB8idWXltDhd2A6LOv4g6Fd53eTOx4wy5NF0Ed0aCTQYZoMG+yE+WL9VY61L6g+jJr14WR tsjXFxVuGFzyqVqLp43kLlvNL2S7Vp1vgxxbsY9mZzj5mxudqBiQgGnn2g0bxhLeVbp6oOr4/ vF2ZBFtgIF2Tmof+ac3Z5lfnJdzKtTFYLM33O8fspWr67Gj5Gj1l5W/4kt0H16qMw1m7H5OQx OMBnnNUzm9uE3NzRGNqg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The /dev/rawX implementation already handles these just fine, so the entries in the table are not needed any more. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 4 ---- 1 file changed, 4 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 37f45644528a..6070481f2b6a 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -422,9 +421,6 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN) COMPATIBLE_IOCTL(PPPIOCATTCHAN) COMPATIBLE_IOCTL(PPPIOCGCHAN) COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) -/* Raw devices */ -COMPATIBLE_IOCTL(RAW_SETBIND) -COMPATIBLE_IOCTL(RAW_GETBIND) /* Watchdog */ COMPATIBLE_IOCTL(WDIOC_GETSUPPORT) COMPATIBLE_IOCTL(WDIOC_GETSTATUS) From patchwork Wed Oct 9 19:10:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175654 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1172684ill; Wed, 9 Oct 2019 12:13:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0fjQjJ4dAOut/IK8OZcEZdIc1wuDWYd1AUVatkWF0UGNkX63IwLiswhyWuH2NPw4wkfa0 X-Received: by 2002:a17:906:1f16:: with SMTP id w22mr4416173ejj.5.1570648380982; Wed, 09 Oct 2019 12:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648380; cv=none; d=google.com; s=arc-20160816; b=cB/h1iNPxqi2C3AtUvXLqVrxmvzTGGpWiD9o0+CcIIOZOiafdBF3YTJZNKL2mT3xF/ D9RooPd2Xm8qRydgqWlHFUI78Mco6Jh2KP5cDDtijNJ1/8iDCBBSXE1mt6Oc4pqIQQYw F0888ST5mkO7NvW8nPKFKOqHN2XFkjBwBuEn50J5lmQoZUyFd5/PC8BQiQNhcW6WRKdf AQE+fNjWxm/sd+dc/GXNGDfsYs95DMzJuTk86OpAul6YEzQnPjWVAeRWxm2VCwkR3HEt Svz9rtvBeVllO59tdd46DYCRqyFvmytghMO9hPp/1tzU15p8ymRZx8ndUUKPtDOYvt6R eeYg== 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=Ya0vuI+XJlGOPLdGvKS65YFkVCMh7ek2lcl3Myjaf5o=; b=v/04wnMl1UssxhUTgPOsRyPd0IebyUSweUUMdEGtKWPu41kHLRQjSPu6VIX5dQUqE9 yKlgDuab8N04EvIvienWVmT/iSIHIX2wLxYOocrdcy8fpJJ7pq6JYheJcCzRTg8j9m0v E3R/oErdR5ScsPr2hoJenHqcoXydWJaLJx0lzekU2gDCTUD+8pDudNKhrkzSQM6tduVF yQszcC9d4OGZqFUqKUypotyTSW38BuGhpi6JEgipl0LqWYoEU/L8ZNaekheqIwmUTMkv fxS7yzRfUyThgADAZL2FkTrU1c4Fzvy7n7aSIOHu2ms4Pxxt5i2nN4Sf29jtcUUjYRTJ Uygg== 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 y10si1671077ejw.76.2019.10.09.12.13.00; Wed, 09 Oct 2019 12:13:00 -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 S1732041AbfJITL3 (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:29 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:44075 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731925AbfJITLU (ORCPT ); Wed, 9 Oct 2019 15:11:20 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1Ml6Zo-1hohFn2sKC-00lYdf; Wed, 09 Oct 2019 21:11:15 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , linux-raid@vger.kernel.org, Song Liu Subject: [PATCH v6 27/43] compat_ioctl: remove last RAID handling code Date: Wed, 9 Oct 2019 21:10:27 +0200 Message-Id: <20191009191044.308087-27-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:3CRT9Z12XUAyRUQyiP/Ny9jsvP99Xt3bB4wOaOH4lYcwl+MCQmr 4ny/SJ3flpq9XK569lBll1lT+ZebWGdnOOHMhvGO3qCwoz3R1rpUDMrZlo3M/drYoWDwS97 fHvSUA8p0sJNSXSBi2aKEM5iDl0xiG4oz9jUNO3T4N9PHEyZTyWhwc5eOnRcJolaM34C1Cw +qLzsqgP6uZJnGqvz02Tg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Q7U5lfH9wpw=:NS4oi3Rk6pVuu5vooRritq cps6Gej39jDT2cTqPxuf34ErLBzJwUGbB9MHBLGdxFjlZ/BTru2GpXZI1bTfCCCuZ+0rUTasl xW6GAbhakr3dpYLVvCIcRfAoC/W7nOo4muDIL6OrOt8LRkhBQszFs7KInwH2hwZs2FS+cHQU8 N0NJuAQn1l4YAvTkkUPHnxDtUKEnx1Znl9aNbVSXwL5WA2jrcS0Nl5mXBamrkbfbLEhaOyw4C hqKkI96iPLmGYNwJGA4JC9S1uSIza7xXW+aYpZq3uasQAEEDgMuhXNXbN2/DHnyiM4uXdgwoB VTCUMQBCZIQDSca7ZyanfcjhQfGWxWiqAVqhDSQEppX/ZmxU+TJzHDcXg2gjzBU1BnHIEmAVH GdLqDg4mrT7dkULbGuvDiwhKlbnpdzYYyts0e9HmXsD7m4U04tW7USN1szd1Pqn1xercATVMv P+NkntIgTyWqM2Y/WTtdmUoIXqLvYP5r/DgXUwf6uKRqWMM9uu5sqgDfE39d0Vn1pRxL49bQm Q/dTVVHR+6M8f8ltlaI/aXDeMpWOuH4O1/QBVTCOfb1QSjULoid4X+Suh/pYR/9O6kGSdcP41 7S/8IBIHfDS1XJQmSEMB06ZlPF5egvAADFn+pEdw5nGlyt5PKKSy4sRXwUyndJ1eKsCCP1FDo pto1YyLZmQxa3Of/gudfvp4mGSNUKISXxtBUlu5CYQZHRFx5YO/wkWXAZOC89Pa8ZLiYLXyFi BXEerVpyU1zR5QL3cKpidsyN6Cn6zCags5Exsxglfn+3h7+l/r7MnkqH5KFFx2RzIO2X8Z2Jt CWZS8ZdZVV275ynQNraysjmfCUP6dXdE2oXnTjzwdLThEuOlPtFLS1zXl+UTd03zc59oNqV6m pyOKfuVdbxzihoVzqPDA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit aa98aa31987a ("md: move compat_ioctl handling into md.c") already removed the COMPATIBLE_IOCTL() table entries and added a complete implementation, but a few lines got left behind and should also be removed here. Cc: linux-raid@vger.kernel.org Cc: Song Liu Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 13 ------------- 1 file changed, 13 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 6070481f2b6a..1ed32cca2176 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -462,19 +462,6 @@ static long do_ioctl_trans(unsigned int cmd, #endif } - /* - * These take an integer instead of a pointer as 'arg', - * so we must not do a compat_ptr() translation. - */ - switch (cmd) { - /* RAID */ - case HOT_REMOVE_DISK: - case HOT_ADD_DISK: - case SET_DISK_FAULTY: - case SET_BITMAP_FILE: - return vfs_ioctl(file, cmd, arg); - } - return -ENOIOCTLCMD; } From patchwork Wed Oct 9 19:10:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175665 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1174011ill; Wed, 9 Oct 2019 12:14:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqykB9tSFJY+Gwt4hkIy/AvWV45uwneTFREYN7eC5JqXF/yo7AH0uJkMQyAU+rn+H1gKYeIS X-Received: by 2002:a17:906:c4a:: with SMTP id t10mr4415378ejf.290.1570648451099; Wed, 09 Oct 2019 12:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648451; cv=none; d=google.com; s=arc-20160816; b=yKbzsoH6A/rJB/O54hQ18AklCjeZaQ+lqeqyfDB/jaHTe5AJFluElDFQAJaxFxT9Cn DW5KuZhPvzLPzOfkqHh31i6dT4G/zjYCm3otH5D0swJSuHCq8QDWzDbFQIfnkqZmqVO5 OodENuA1MeiaS2gqM2sTsVgm2KgRl9f3ETB6cU0FfCICYhh9dwq2mcHhvepNYyrcT3sq 1gMnqflbzAR5IMEkg7xns+7M6d7QPQOv3JWcOG0ssbzlOgfn4F/IYNf3htwNaR08+M7X J/xtMo4hF6Xcf9HhZb7SFFYzsIKsbcsOkwpbTCGKnKMvsBg+JTysJDxm13b0vVecXCbE BCAA== 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=wQY8Db8nf7xHoq9QUXbPSdb0tD45IjUWJWgFTTgZaCY=; b=oI2TqF6/eTsZ97wdQYEteSzpgld2WtEd9yLTlo2kMkmU8vsX3+Q03FwMvGmhK/2IV1 X3lNpupbayM3f3DUnajQVJb4KhBrz/cBwy5F+eBNBobru9lXfHE72kszDnbpmH7GqSWq Fa/rd0CGspZnLen+d6NG51qetcmGv3dYMjAxMtAoufHbExwR4c6vqzpXgejyMElHjzpu 5Lrqm3p0i+7pOK4Qr1PEeIq9CWEpK66fMOOo85ewMW7zQnoEQvWuWAZwh4xI9KBHLghG jGBJMn3mgR/vBbmo3OulEivNBCcZPrzeM9xfrhikUDvOrqhJ9nJRIenOxncWYaU7Tqca RAeA== 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 f7si1655828ejt.155.2019.10.09.12.14.10; Wed, 09 Oct 2019 12:14:11 -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 S1732487AbfJITOK (ORCPT + 26 others); Wed, 9 Oct 2019 15:14:10 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:49147 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731884AbfJITLR (ORCPT ); Wed, 9 Oct 2019 15:11:17 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MRn0U-1ifyMT40R0-00TCk1; Wed, 09 Oct 2019 21:11:16 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 28/43] compat_ioctl: remove unused convert_in_user macro Date: Wed, 9 Oct 2019 21:10:28 +0200 Message-Id: <20191009191044.308087-28-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:dxM3Jam6TjHHvCF48LVo6gIfXiFPc6pem5dnhWv8FdfWs/yzMLy yFeFJW+IziOK7Os4wZmRjmYkpkYL4VLvBYQeuhabIMTi5fe6jmiJQ9YoJsQmsyoStwlZnYa +vLbKCn5FXBGJ7dQy6KV8rxhA+WIy+6uoPLGC9bhwKuR/wsCegm9o6KdoyFhbYnrZCzlSPv IgMu5fqbTkuzblCrLmFfw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:WNKsKDDFZ/E=:pSkQDFwu4n0WOuakXlt/jd ykqiJT3eFWg05XP76lBbAaLwiBF/CzorjHaWEyxJALsvEqCBTMLd5LivOaF/20QTC0bHVpdTt S+YF4ik1L0l5Vhmj6EL6PgJ6jJIFZWbrc7DUWsv+yKSr4e+u82bnDSpAbAGnyJ0jydkb8trpS 5Ot8XQzAwdPxVcPOXQTHWJXzc2yKZcaApYZqOFWSzxTSxPUkcM0RLzypv0o/kiUx0vhUwMPHW vrGq7E4NZjitDeKJnJMkWqv2PeYrVvl0MYQiiRoDoaiPkKe0TXuO+jeZ+shbhMd6M82x34ARG w27t2+bzvhqc+4mCBPVxOxFokGZlue8+aF+r2BVBBaWp/h2fC3pSXsdn4rRSGgsWdxt5rdJop 72iyPGVWuuFz20i0Phrj+Jzec41AMQgeqZCCbwoBI7yW1XMZmyYEFVtNMRJ0lHQTw0Xe82NuM /EbeV4xAysemTtY2+Ud/R4yAehV1v+0KBBr7tT3tMi6X1QSiqFHOkNx2TAgXbspy+h52yN6ID jCL9S3iX0TbRdAniN7ITxIqlZIFv/XXDwKDLNkFwjeMT2yWdzMnPaVJFWXEZEuZYStHv5Q+Il IWwrj1m3s6VX3UEH9/15iXtuF0s0ilB/+MuXhE6uOHl9sYmSZ45CXo5k1GlSCrU1sFswPUmsv qeO5w0juMXKyNIJiUC87WqCVbEiDXS4Iz+8J9WPnT89KJQZAag7Z5Kug2TrtVqRducVN/vkyg Sntb+4M6vOKl8i+DwtGPkeuC5W6G/J3tuij/YTLToGOc5jqLuwCqYFdcfeljwqfcQgaXP95Su WT1u1L8cv8N1972cO7ATrlpGTXEMiO9t1+y+YNRhWxNuSch0UG8EmXXldm50v6FTkyPiXNzR8 j3ShWvO4LTToGT0dw9zw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The last users are all gone, so let's remove the macro as well. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 7 ------- 1 file changed, 7 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 1ed32cca2176..1e740f4406d3 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -52,13 +52,6 @@ #include -#define convert_in_user(srcptr, dstptr) \ -({ \ - typeof(*srcptr) val; \ - \ - get_user(val, srcptr) || put_user(val, dstptr); \ -}) - static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int err; From patchwork Wed Oct 9 19:10:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175641 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1170860ill; Wed, 9 Oct 2019 12:11:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFk9jWROiZoMZ9s6zu8df7/avP/kxes9TT6ua7mDJuweSo46zJXreMZdyyO+sJZyRvddcU X-Received: by 2002:a17:906:ce2e:: with SMTP id sd14mr4455251ejb.197.1570648293876; Wed, 09 Oct 2019 12:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648293; cv=none; d=google.com; s=arc-20160816; b=woGkAj29C9+644CJMQlcGbjRG3v3D2UxPzBQwDveSkB01urFEUNEYaF2h5f+SnBXAu d/mrdKq5t4Xy2UA7k+kQLN7OzzaB3cAT0J1k3HyhPEK6Cy6mi+69gnatJBUZj/4YkzJ+ 0pYhmAkpvrOBMjnJpzlwhmcuTVQ9srXDQEeZWoljbPdwd9FURmO8HY0aaub2g78bBz93 oj4z2wqdp1qB4W+CFs7AuDhc8k8frngieXCI/LR7/XSJMDiMWoA3IOW+xpweas+MgQoG C8y6PjhmCe8Qe0rmjlTz3sMTzvkGbfdS58etGpWCshHCsW1pjY+Tgb8slt6hb5y4LZb2 jbSA== 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=NjzwNAEKQOF/6jQ2nPGSji5yUKEkH7W/nWBM9piVTZE=; b=pdz2h+X9F91FF/HWXFlU5tiFR7prJF+hNPZehVKHny8kueFMS0+jSUMzBlDwgV94HH Xp1uYMio1CZ5qmW+T4JYFXpec34GLQY+CGyfmx96M7WDnkjWxTY1fM91Cw00uAAbHwgP gez8nR/5hqFQ7dZftaF7vQyYKVyqNYxwi0hrJcBGhG64vn1uFMMDxqsR6zFui5JFb5UP f893z36UHPcRcBHRD7gjBdoDISSXegM5y1ikbMy39tZKsIAJHswzQ4AdADau7+X2xx2M 9lPPVf5IOCUR7OKpwm/x9iTTXEl+IZNg3nc/4lUSEruzcGv5tIPphk2j6OuNvj0E+8WS zHQg== 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 f45si2025728eda.345.2019.10.09.12.11.33; Wed, 09 Oct 2019 12:11:33 -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 S1732086AbfJITLc (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:32 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:34679 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731936AbfJITLU (ORCPT ); Wed, 9 Oct 2019 15:11:20 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MGQSj-1iJcHh1zkj-00GsWY; Wed, 09 Oct 2019 21:11:16 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Bob Peterson Subject: [PATCH v6 29/43] REPLACE gfs2: add compat_ioctl support Date: Wed, 9 Oct 2019 21:10:30 +0200 Message-Id: <20191009191044.308087-30-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:cS3/sfwAkrlKljto27S6eVG/uuPsCXcx4FSTY4203dGSHJvWpBw Y/QigecS3No2SqHeWCOGB/W6xC1Ok3w8tcPq9dlYEdZm3BatlYEYVv/wmbhhaLlDcp8uxHs C7lXB1/M5UDHms6xRtOLlXy6Fb0SM4Q7UclbwQgDMDarQqmByhg7nKD8pPDl9rdsGEgG3lD B/HkZp8uQR7x7zFN8P+nQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:lqrUhAhzDB4=:R09Cty2tcFGQtALD0fbRvq 6rGoeKKmIVe4e+wj5XtkY9Np2XBJMJ/te+tI2sr5syyE1YE3/fBWVAd4A/ZbtZ27vtaw++gc1 BU4WDcVKKsTcSPdMT8ZSkWaU9XCAVov2ps9NCFt1WKEjPDDtTMt1XkSG4Q93KKke4lCBLVU0/ RLt49ycv4tzqkPgfYEyNwVMhgwPaR6KwDPO+DbjBMEBN1Zw/zuv6YewMuAas9/JG90GmfebRA fCelIdGghcHHBH9TL17QTWdMbiPiir9hc7pnbpvxDVkZai7udPUfrakHqP00HwjynnbmRphrF y3PZiTm92s/MxqPORXrrY4P6IErrG5UVhgvYrspWw9xqsvoj3Kpj8pJJa3QRqbrbel4C7v/kF 1obVvQKWJ5T14PLhGlFT0+2OUJOz1dTdDh9oGSLeeMaJK+iunfEajhjuluZbmXg3LABjM4Nm6 3pF02f/p9HmZs1UVmDoOYH9P9wsxUF4G5YSZgBu5qdZmLAH0bR38lzujAXtDV9OgHV7B60YhB k1pJ91U8s8++o2D56cN+RXVe1WmKDEUsmSkl4l650yrf+fDOtgrDpOHQ519OQK5mjUWDIF3Xz +Q72rzqE1dkX45PSBLYTtk0MQIj8+cUO4ZCBLKdxEOoZ5b1G6oVvaurOVi+dm5PuAgnD1BSaC 0I1gn6qWBcWXmV4UTbjroBaxWN57Txmz/I5dNgde9Ux/bFEpn4FCHBxq74fhlrKQ+mh7sR6fC HMdLDCHPMXXdv2uQNn52oAOWr0LluqK8Xm1lhQN2w1CmRAVZTfF6s9UfM83UipxhtNKTq1qKz XsOTI865bM7o4iWQ7iWPeEN0JJ3B+FXzrOaDo80mpnWseZRhqS7bnA1vjaDLI8ULdBqXW7W65 fKC9RxEY8zTuLOe9aGWg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Out of the four ioctl commands supported on gfs2, only FITRIM works in compat mode. Add a proper handler based on the ext4 implementation. Fixes: 6ddc5c3ddf25 ("gfs2: getlabel support") Reviewed-by: Bob Peterson Signed-off-by: Arnd Bergmann --- fs/gfs2/file.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) -- 2.20.0 diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 997b326247e2..e073050c1f2a 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -354,6 +355,31 @@ static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return -ENOTTY; } +#ifdef CONFIG_COMPAT +static long gfs2_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + switch(cmd) { + /* These are just misnamed, they actually get/put from/to user an int */ + case FS_IOC32_GETFLAGS: + cmd = FS_IOC_GETFLAGS; + break; + case FS_IOC32_SETFLAGS: + cmd = FS_IOC_SETFLAGS; + break; + /* Keep this list in sync with gfs2_ioctl */ + case FITRIM: + case FS_IOC_GETFSLABEL: + break; + default: + return -ENOIOCTLCMD; + } + + return gfs2_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); +} +#else +#define gfs2_compat_ioctl NULL +#endif + /** * gfs2_size_hint - Give a hint to the size of a write request * @filep: The struct file @@ -1293,6 +1319,7 @@ const struct file_operations gfs2_file_fops = { .write_iter = gfs2_file_write_iter, .iopoll = iomap_dio_iopoll, .unlocked_ioctl = gfs2_ioctl, + .compat_ioctl = gfs2_compat_ioctl, .mmap = gfs2_mmap, .open = gfs2_open, .release = gfs2_release, @@ -1308,6 +1335,7 @@ const struct file_operations gfs2_file_fops = { const struct file_operations gfs2_dir_fops = { .iterate_shared = gfs2_readdir, .unlocked_ioctl = gfs2_ioctl, + .compat_ioctl = gfs2_compat_ioctl, .open = gfs2_open, .release = gfs2_release, .fsync = gfs2_fsync, @@ -1324,6 +1352,7 @@ const struct file_operations gfs2_file_fops_nolock = { .write_iter = gfs2_file_write_iter, .iopoll = iomap_dio_iopoll, .unlocked_ioctl = gfs2_ioctl, + .compat_ioctl = gfs2_compat_ioctl, .mmap = gfs2_mmap, .open = gfs2_open, .release = gfs2_release, @@ -1337,6 +1366,7 @@ const struct file_operations gfs2_file_fops_nolock = { const struct file_operations gfs2_dir_fops_nolock = { .iterate_shared = gfs2_readdir, .unlocked_ioctl = gfs2_ioctl, + .compat_ioctl = gfs2_compat_ioctl, .open = gfs2_open, .release = gfs2_release, .fsync = gfs2_fsync, From patchwork Wed Oct 9 19:10:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175651 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1172239ill; Wed, 9 Oct 2019 12:12:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzLGE2zITWIewgC/vQbgBPYaYCdwgdDmJylFAcuzujmduzaH5uggD1FSQLPi8ExYMcq97K X-Received: by 2002:a05:6402:1b91:: with SMTP id cc17mr4395832edb.180.1570648359073; Wed, 09 Oct 2019 12:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648359; cv=none; d=google.com; s=arc-20160816; b=Uic7q0/AAmnOG6RyGnN11XsPsWYw81MipHAmI5w0k4Dhkuh67x6W6evthHwzTJyckX AlYOnBZ1yAkN82TzAatGT5NDk3WrcoArmI5rnTt0bsddJpuFj2pSxoFvfLB3TnM8gbXd uAdvfFl97xMvoGq7FGz5S2mdmiEyDgVQFFkfP8ibDwoJeKgifOpR/XG3TyGgMLZ2d+qn HoD9OeaDztk6B7a49F2Pb32GnlF0RtxD19vDk0Mrdhwp07n4B0RjCUp7q8OCkzp32vgm /cmeoxsZIIzPGsS2eJlJKS6EiYejQKsz6Ecn55WdVZobWhi6lKLTzKzMS04ObK6pYtKE sXvg== 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=Dxs1u7c2bciEzprx2dHjq2PEf8lekbaefd+HGVmBGbg=; b=vDDyWl3HkXzvp8UrS6Wt7Tk2Q8StHj2QCaZv+Laaz6Bf6fnSaEYi+UU8dEOfnl3mQg DLUxqcs6gmDf3uSdzyqK03RvQYNufatPiiJ5B+1O8d93kt2qm59xBmdMAzXFN1abfVqJ ZnQTD3++fTgIBWF7b0PuznuqKkHt+NGomSy6RqcCB6cxHQj2wBiYZh9qnKPMHp0cHM2a GIOIGof6WMvVVeLO9IzNVGYSaVx3dhrBGsrdHjYK1Wc8WIqhc2Kj0s9l9tDyo3zfxmPJ Y6LqaVWWV01N40cBOK8Sp0JH2GlZMX6wY/AzyqwaBr97UX0UE20dGrDiPzlFgnbrWMS3 fcNQ== 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 e22si1891941ejm.72.2019.10.09.12.12.38; Wed, 09 Oct 2019 12:12:39 -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 S1732322AbfJITMi (ORCPT + 26 others); Wed, 9 Oct 2019 15:12:38 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:55809 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732056AbfJITLb (ORCPT ); Wed, 9 Oct 2019 15:11:31 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mbzdn-1hfexe4BV1-00dXse; Wed, 09 Oct 2019 21:11:18 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Mikulas Patocka , linux-nilfs@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [PATCH v6 30/43] fs: compat_ioctl: move FITRIM emulation into file systems Date: Wed, 9 Oct 2019 21:10:31 +0200 Message-Id: <20191009191044.308087-31-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Yt5Qym2EiThPkdPiZuVWsOArs8kXwnMpYv8e8jcFHq6aBlEUl35 2IN5+k0io/Ejnt6hQYqU5PeavuhijMbDbcKRb1ZxQ/6UItKgQqaET9+WeQFtRybNXL/7Evn QrMfvNL1I0AWYpCpt9cUDrfru1T2gMRukpp+x7ARQhmEKsY4PWg2oSrpD+oymHu2Kj+/KUc T+MrdQgXOJZMCEpqnSOug== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:7szO+vH6EQs=:V71EFPjAZtDgdRdkiMO12Q GDLOgoe6xabrsRpK8dss/1FbSbd0/LRu8BSTX7ftPlUZ+ZrQO/H/faHx7JJk8RieIGlFgEcTT EXof9rfzqoBpUY3NJs2WvGoyHioXGOJcv1Ti4timVZ1CMpKrwZubVAerQ6bQxbTMwoXlwZhPJ WJWhKviJJ+5ZHWTRMNkj74RwxD4yVonQ4W5VjBHlK1Oo0eblhb0poFzhDCODP46ISMsi/9YD2 Z4V+18ywpVntd+bOeYwYzv7eX5gkuhOSj+XrBOKfyrRP+pT8nx6Ukjzvd9oHcdrcJFvC8AcvM TvBxzq9XsZnQzQ+IfDnHkROqfzx2gcSDKD0pN7QcP8+NDDTTDn+mTZ1jyWFe8szzoDIEf/in/ Z5HsDqhyHAMOZrRu2p2/5NLbSZdH+gtKjTP7Bm+rsQUQtZoA5sZqPZA5Ke8MPiljJxYAjb3V+ 8tAWysmnPhzKCTGzz55hWPESGavXF+hXB1U4zToeD0cfYLJFxIXVuC8mA75CIHsiUhPaOlrM+ S3nXh/SqKBSkahI3UkokDIAHWkeuXN0A9Ra894zoJWdvH9wNUbJsLtVGIM/fifxQThNlWYT5T 6R1gelJX7GGYk1z8i6JQP1goaezQjXRvWLMhZVXgf04QdLYqzPCZ0deY+X6VpUqvBULcsaxWj j4pGbhm+vSq8rHNdmFVEWNgmvZX9otZDdg2NWWjUTy9l7RSbYel3vhdr4QBBswTCE/pvQbuiK haSKR+87qyJ1+499CCnOZ8trUag2y5Kb3V9ee/cpkoDhqP0imin4VTobW5LCiZIFp3Y/AbzmZ FtTTQ0cj7UlAaaqwms/+RToktTC6bvO2m2r1rUqodivpkKTexLJqOe/arDm2yym9T4zGxA0VQ +W/7eVUm3osaGfa39ACA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the special case for FITRIM, and make file systems handle that like all other ioctl commands with their own handlers. Cc: linux-ext4@vger.kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net Cc: Mikulas Patocka Cc: linux-nilfs@vger.kernel.org Cc: ocfs2-devel@oss.oracle.com Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 2 -- fs/ecryptfs/file.c | 1 + fs/ext4/ioctl.c | 1 + fs/f2fs/file.c | 1 + fs/hpfs/dir.c | 1 + fs/hpfs/file.c | 1 + fs/nilfs2/ioctl.c | 1 + fs/ocfs2/ioctl.c | 1 + 8 files changed, 7 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 1e740f4406d3..b20228c19ccd 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -345,8 +345,6 @@ static int ppp_scompress(struct file *file, unsigned int cmd, static unsigned int ioctl_pointer[] = { /* Little t */ COMPATIBLE_IOCTL(TIOCOUTQ) -/* 'X' - originally XFS but some now in the VFS */ -COMPATIBLE_IOCTL(FITRIM) #ifdef CONFIG_BLOCK /* Big S */ COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN) diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index feecb57defa7..5fb45d865ce5 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c @@ -378,6 +378,7 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return rc; switch (cmd) { + case FITRIM: case FS_IOC32_GETFLAGS: case FS_IOC32_SETFLAGS: case FS_IOC32_GETVERSION: diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 0b7f316fd30f..e8870fff8224 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -1360,6 +1360,7 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } case EXT4_IOC_MOVE_EXT: case EXT4_IOC_RESIZE_FS: + case FITRIM: case EXT4_IOC_PRECACHE_EXTENTS: case EXT4_IOC_SET_ENCRYPTION_POLICY: case EXT4_IOC_GET_ENCRYPTION_PWSALT: diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 29bc0a542759..57d82f2d2ebd 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3403,6 +3403,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case F2FS_IOC_RELEASE_VOLATILE_WRITE: case F2FS_IOC_ABORT_VOLATILE_WRITE: case F2FS_IOC_SHUTDOWN: + case FITRIM: case F2FS_IOC_SET_ENCRYPTION_POLICY: case F2FS_IOC_GET_ENCRYPTION_PWSALT: case F2FS_IOC_GET_ENCRYPTION_POLICY: diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index d85230c84ef2..f32f15669996 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c @@ -325,4 +325,5 @@ const struct file_operations hpfs_dir_ops = .release = hpfs_dir_release, .fsync = hpfs_file_fsync, .unlocked_ioctl = hpfs_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 1ecec124e76f..b36abf9cb345 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c @@ -215,6 +215,7 @@ const struct file_operations hpfs_file_ops = .fsync = hpfs_file_fsync, .splice_read = generic_file_splice_read, .unlocked_ioctl = hpfs_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; const struct inode_operations hpfs_file_iops = diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 91b9dac6b2cc..4ba73dbf3e8d 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c @@ -1354,6 +1354,7 @@ long nilfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) case NILFS_IOCTL_SYNC: case NILFS_IOCTL_RESIZE: case NILFS_IOCTL_SET_ALLOC_RANGE: + case FITRIM: break; default: return -ENOIOCTLCMD; diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index d6f7b299eb23..2d517b5ec6ac 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c @@ -985,6 +985,7 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) return -EFAULT; return ocfs2_info_handle(inode, &info, 1); + case FITRIM: case OCFS2_IOC_MOVE_EXT: break; default: From patchwork Wed Oct 9 19:10:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175644 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171245ill; Wed, 9 Oct 2019 12:11:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7sdEb/4Vp2OD8KiQibYThjiBDHtHc4lPE8Z9HdFyD9h29OSqOAkvF+p/W1ezgkleBSmuy X-Received: by 2002:aa7:d3ca:: with SMTP id o10mr4453169edr.279.1570648310145; Wed, 09 Oct 2019 12:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648310; cv=none; d=google.com; s=arc-20160816; b=Q0VrXNjSNWUzQAvKX7FH2C28fBI67J67PVENyTCU3JxC501SJyyFkoOLdszGy/eJaT TPDS0daLBCQtYM19HT3FhfduvrKep+hqliJnBeCcp3qOxsEzK1OkUcDgG940mLSnhrle 8Blial54VXFdnF61nBk+mT3xAYU0/choTKfkUTZ6ia2lxwcTaw4JkCJTlXswYUojUAdK D2OibWw8aeIxoXnEWcZMAStNRkw0xLVO4p/L2vmGQoCsTnkKTCfR2eEc//dJMW0B73J6 mztKxAl/QmzQql+O7hHYIRK+l+qSsVTdSwD/GdtEU505Ooa84TjLZdT7mpjXmH9O64NT rZuQ== 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=z/57Ifm2r6HzuenG1zdCubDh3hEwIuB+4Xk+gt8O5x8=; b=Vds2ysJFWNOsDvDotIyllxWyxnG2prDjC0DNZcx1JPfX1VKTMX6J4bbl5Pp7Rl3aBU EFTsD0OWuskMyfCUC5fFvDDwzuYYUFTo/Gdx34t7+76U9bh3gwt3LiOjjfXwdfX9rzn4 RZHmlGzi4QmRnVrNIS44qQUOYixbVuv5febhr04cX9jYLxubBhIiHByT/t0vRbJDCIBJ AfLq/VNECY28xdmMv8s3tqFjy6P2wYJSVz6U0cG/RFQY0JXr1cy40SyNTCJIJz861Exu sd+oaU/u5qQiD2ro+3U4J5JCZVOOA0ZvDEXd4jYVLhoQmkMzxyUDH8I9QKcCcIzfpUXW KYFQ== 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 va7si1709036ejb.4.2019.10.09.12.11.49; Wed, 09 Oct 2019 12:11:50 -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 S1732199AbfJITLt (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:49 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:56877 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732124AbfJITLp (ORCPT ); Wed, 9 Oct 2019 15:11:45 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MCKWI-1iQUqK2ipe-009Tzp; Wed, 09 Oct 2019 21:11:18 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Guenter Roeck Subject: [PATCH v6 31/43] compat_ioctl: move WDIOC handling into wdt drivers Date: Wed, 9 Oct 2019 21:10:32 +0200 Message-Id: <20191009191044.308087-32-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ssZFNzCp+wNDQXWpbjSeCwSTuhi58vFlkTZQDnBuy67Jik1jN7X BBHGkCCpVySnWWND/wWoKEgzOOdiY6isKU6i3vrjZn6Tu36Yv6BIb5pwre+++mtX+yZwodX RoRKhgjePPnBs2HE5TKqE6E3wL6WbHM7mq8MVgrTcqN5OdYB9cmdhWsbTyv5Xd2PeDOvCTg i/7f/lznvv3HUeMhJPtFw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:a5F5dDvuDck=:tOPwOn1JEObG3km+R+8wu8 /WTa9BJFanO+w1gvI9H+ZMiWcpdr9jYniHzV495ZzOOs010taMu7kdZfQF+IqFfnJHypMMHx5 z1fJC8qkO8nGw/2ZkFYU8zMwKwz+lHN6rLKWayXYMtMSKOfc3WDN7HZpHg07rlytJOcxaR6l1 lKvhbf6T5O799qM9+zl+RGltWjQ5tJjB8gx7YE56Z6tr1Brxqm2ciQus067fE9aWihL8NHsf6 VSfBMYH5G4nsCS28nVTRpEdgp8e5JrKEtqIfqM9DRPxVwf2fXbgyHZPnaZe5ECzOf8HGw1xDQ 1YOM+OHpuw36DuLoeh8VQBED/PA3XzREJ5xsWbeiD0V0c9ghEWnVREurX1ky5zXQSZgfSE98O 9moyP67fGDh609ot/4DjgxX7rR8GGP1JJmpZM+DGUrAIRRpZmzhFmb21nVJ+ZBvRhfIFFy3Sy jiqNVE/hJxZWBak31zMrLU8Ik6ygyuX8Vpuq87JnaWF/l03MoTSuMqn5pK+36EkuyCtQmkqr3 oR08zH5yGgGj5tW/4bMSELCj5r2N4k72VWLzVXv/5WL0M3hmPx0L+tCat5vOS5gdbdo81VcLO OkKyndS4KXpsNux62kSbFTQAf8PCvbj+BL+ZaTWBetLF5SSwrIKjtIT0GT0tSAhrOTBb/HFGw C6xPY+dQOfbzWXXUlhMst0uE/VSTcFV+kwPztdcjWl3lw4OTmc33V69ysAm7UvYj+ts1Vuvhi tk6z7suAG0YUh2SITCsd7tC5Ex7J0DUtp9ljgIzTxmxCatY/TbZYLBZQL3nkDnc6C110rcdAM 0KnFxCXwy0lfGeKCEvw4uW4RwKWxu95B/yK+0T6WOnDQmvUBMd1fMdyciXo+U6tXNqdyRvC7J iy9c0U7JeeN5udP+bhGA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All watchdog drivers implement the same set of ioctl commands, and fortunately all of them are compatible between 32-bit and 64-bit architectures. Modern drivers always go through drivers/watchdog/wdt.c as an abstraction layer, but older ones implement their own file_operations on a character device for this. Move the handling from fs/compat_ioctl.c into the individual drivers. Note that most of the legacy drivers will never be used on 64-bit hardware, because they are for an old 32-bit SoC implementation, but doing them all at once is safer than trying to guess which ones do or do not need the compat_ioctl handling. Reviewed-by: Guenter Roeck Signed-off-by: Arnd Bergmann --- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 1 + arch/um/drivers/harddog_kern.c | 1 + drivers/char/ipmi/ipmi_watchdog.c | 1 + drivers/hwmon/fschmd.c | 1 + drivers/rtc/rtc-ds1374.c | 1 + drivers/watchdog/acquirewdt.c | 1 + drivers/watchdog/advantechwdt.c | 1 + drivers/watchdog/alim1535_wdt.c | 1 + drivers/watchdog/alim7101_wdt.c | 1 + drivers/watchdog/ar7_wdt.c | 1 + drivers/watchdog/at91rm9200_wdt.c | 1 + drivers/watchdog/ath79_wdt.c | 1 + drivers/watchdog/bcm63xx_wdt.c | 1 + drivers/watchdog/cpu5wdt.c | 1 + drivers/watchdog/eurotechwdt.c | 1 + drivers/watchdog/f71808e_wdt.c | 1 + drivers/watchdog/gef_wdt.c | 1 + drivers/watchdog/geodewdt.c | 1 + drivers/watchdog/ib700wdt.c | 1 + drivers/watchdog/ibmasr.c | 1 + drivers/watchdog/indydog.c | 1 + drivers/watchdog/intel_scu_watchdog.c | 1 + drivers/watchdog/iop_wdt.c | 1 + drivers/watchdog/it8712f_wdt.c | 1 + drivers/watchdog/ixp4xx_wdt.c | 1 + drivers/watchdog/m54xx_wdt.c | 1 + drivers/watchdog/machzwd.c | 1 + drivers/watchdog/mixcomwd.c | 1 + drivers/watchdog/mtx-1_wdt.c | 1 + drivers/watchdog/mv64x60_wdt.c | 1 + drivers/watchdog/nv_tco.c | 1 + drivers/watchdog/pc87413_wdt.c | 1 + drivers/watchdog/pcwd.c | 1 + drivers/watchdog/pcwd_pci.c | 1 + drivers/watchdog/pcwd_usb.c | 1 + drivers/watchdog/pika_wdt.c | 1 + drivers/watchdog/pnx833x_wdt.c | 1 + drivers/watchdog/rc32434_wdt.c | 1 + drivers/watchdog/rdc321x_wdt.c | 1 + drivers/watchdog/riowd.c | 1 + drivers/watchdog/sa1100_wdt.c | 1 + drivers/watchdog/sb_wdog.c | 1 + drivers/watchdog/sbc60xxwdt.c | 1 + drivers/watchdog/sbc7240_wdt.c | 1 + drivers/watchdog/sbc_epx_c3.c | 1 + drivers/watchdog/sbc_fitpc2_wdt.c | 1 + drivers/watchdog/sc1200wdt.c | 1 + drivers/watchdog/sc520_wdt.c | 1 + drivers/watchdog/sch311x_wdt.c | 1 + drivers/watchdog/scx200_wdt.c | 1 + drivers/watchdog/smsc37b787_wdt.c | 1 + drivers/watchdog/w83877f_wdt.c | 1 + drivers/watchdog/w83977f_wdt.c | 1 + drivers/watchdog/wafer5823wdt.c | 1 + drivers/watchdog/watchdog_dev.c | 1 + drivers/watchdog/wdrtas.c | 1 + drivers/watchdog/wdt.c | 1 + drivers/watchdog/wdt285.c | 1 + drivers/watchdog/wdt977.c | 1 + drivers/watchdog/wdt_pci.c | 1 + fs/compat_ioctl.c | 11 ----------- 61 files changed, 60 insertions(+), 11 deletions(-) -- 2.20.0 diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c index ba12dc14a3d1..8c0d324f657e 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c @@ -650,6 +650,7 @@ static const struct file_operations mpc52xx_wdt_fops = { .llseek = no_llseek, .write = mpc52xx_wdt_write, .unlocked_ioctl = mpc52xx_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = mpc52xx_wdt_open, .release = mpc52xx_wdt_release, }; diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c index 000cb69ba0bc..e6d4f43deba8 100644 --- a/arch/um/drivers/harddog_kern.c +++ b/arch/um/drivers/harddog_kern.c @@ -165,6 +165,7 @@ static const struct file_operations harddog_fops = { .owner = THIS_MODULE, .write = harddog_write, .unlocked_ioctl = harddog_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = harddog_open, .release = harddog_release, .llseek = no_llseek, diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 74c6d1f34132..55986e10a124 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -893,6 +893,7 @@ static const struct file_operations ipmi_wdog_fops = { .poll = ipmi_poll, .write = ipmi_write, .unlocked_ioctl = ipmi_unlocked_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = ipmi_open, .release = ipmi_close, .fasync = ipmi_fasync, diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index fa0c2f1fb443..4136643d8e0c 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c @@ -954,6 +954,7 @@ static const struct file_operations watchdog_fops = { .release = watchdog_release, .write = watchdog_write, .unlocked_ioctl = watchdog_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 367497914c10..6e96916c41ff 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c @@ -586,6 +586,7 @@ static const struct file_operations ds1374_wdt_fops = { .owner = THIS_MODULE, .read = ds1374_wdt_read, .unlocked_ioctl = ds1374_wdt_unlocked_ioctl, + .compat_ioctl = compat_ptr_ioctl, .write = ds1374_wdt_write, .open = ds1374_wdt_open, .release = ds1374_wdt_release, diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c index 848db958411e..bc6f333565d3 100644 --- a/drivers/watchdog/acquirewdt.c +++ b/drivers/watchdog/acquirewdt.c @@ -221,6 +221,7 @@ static const struct file_operations acq_fops = { .llseek = no_llseek, .write = acq_write, .unlocked_ioctl = acq_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = acq_open, .release = acq_close, }; diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c index 0d02bb275b3d..0e4c18a2aa42 100644 --- a/drivers/watchdog/advantechwdt.c +++ b/drivers/watchdog/advantechwdt.c @@ -220,6 +220,7 @@ static const struct file_operations advwdt_fops = { .llseek = no_llseek, .write = advwdt_write, .unlocked_ioctl = advwdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = advwdt_open, .release = advwdt_close, }; diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c index c157dd3d92a3..42338c7d4540 100644 --- a/drivers/watchdog/alim1535_wdt.c +++ b/drivers/watchdog/alim1535_wdt.c @@ -362,6 +362,7 @@ static const struct file_operations ali_fops = { .llseek = no_llseek, .write = ali_write, .unlocked_ioctl = ali_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = ali_open, .release = ali_release, }; diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c index c8e3ab056767..5af0358f4390 100644 --- a/drivers/watchdog/alim7101_wdt.c +++ b/drivers/watchdog/alim7101_wdt.c @@ -294,6 +294,7 @@ static const struct file_operations wdt_fops = { .open = fop_open, .release = fop_close, .unlocked_ioctl = fop_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice wdt_miscdev = { diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index 668a1c704f28..c087027ffd5d 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c @@ -250,6 +250,7 @@ static const struct file_operations ar7_wdt_fops = { .owner = THIS_MODULE, .write = ar7_wdt_write, .unlocked_ioctl = ar7_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = ar7_wdt_open, .release = ar7_wdt_release, .llseek = no_llseek, diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c index 907a4545dee6..6d751eb8191d 100644 --- a/drivers/watchdog/at91rm9200_wdt.c +++ b/drivers/watchdog/at91rm9200_wdt.c @@ -213,6 +213,7 @@ static const struct file_operations at91wdt_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .unlocked_ioctl = at91_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = at91_wdt_open, .release = at91_wdt_close, .write = at91_wdt_write, diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c index 75de664ef4b0..d6dff97c280b 100644 --- a/drivers/watchdog/ath79_wdt.c +++ b/drivers/watchdog/ath79_wdt.c @@ -234,6 +234,7 @@ static const struct file_operations ath79_wdt_fops = { .llseek = no_llseek, .write = ath79_wdt_write, .unlocked_ioctl = ath79_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = ath79_wdt_open, .release = ath79_wdt_release, }; diff --git a/drivers/watchdog/bcm63xx_wdt.c b/drivers/watchdog/bcm63xx_wdt.c index e2af37c9a266..8a043b52aa2f 100644 --- a/drivers/watchdog/bcm63xx_wdt.c +++ b/drivers/watchdog/bcm63xx_wdt.c @@ -221,6 +221,7 @@ static const struct file_operations bcm63xx_wdt_fops = { .llseek = no_llseek, .write = bcm63xx_wdt_write, .unlocked_ioctl = bcm63xx_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = bcm63xx_wdt_open, .release = bcm63xx_wdt_release, }; diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c index d6d53014cb68..9867a3a936df 100644 --- a/drivers/watchdog/cpu5wdt.c +++ b/drivers/watchdog/cpu5wdt.c @@ -187,6 +187,7 @@ static const struct file_operations cpu5wdt_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .unlocked_ioctl = cpu5wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = cpu5wdt_open, .write = cpu5wdt_write, .release = cpu5wdt_release, diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c index 3a83a48abcae..f5ffa7be066e 100644 --- a/drivers/watchdog/eurotechwdt.c +++ b/drivers/watchdog/eurotechwdt.c @@ -371,6 +371,7 @@ static const struct file_operations eurwdt_fops = { .llseek = no_llseek, .write = eurwdt_write, .unlocked_ioctl = eurwdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = eurwdt_open, .release = eurwdt_release, }; diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c index e46104c2fd94..a3c44d75d80e 100644 --- a/drivers/watchdog/f71808e_wdt.c +++ b/drivers/watchdog/f71808e_wdt.c @@ -669,6 +669,7 @@ static const struct file_operations watchdog_fops = { .release = watchdog_release, .write = watchdog_write, .unlocked_ioctl = watchdog_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice watchdog_miscdev = { diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c index 7d5f56994f09..f6541d1b65e3 100644 --- a/drivers/watchdog/gef_wdt.c +++ b/drivers/watchdog/gef_wdt.c @@ -248,6 +248,7 @@ static const struct file_operations gef_wdt_fops = { .llseek = no_llseek, .write = gef_wdt_write, .unlocked_ioctl = gef_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = gef_wdt_open, .release = gef_wdt_release, }; diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 8d105d98908e..9914a4283cb2 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c @@ -201,6 +201,7 @@ static const struct file_operations geodewdt_fops = { .llseek = no_llseek, .write = geodewdt_write, .unlocked_ioctl = geodewdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = geodewdt_open, .release = geodewdt_release, }; diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c index 92fd7f33bc4d..2b65ea9451d1 100644 --- a/drivers/watchdog/ib700wdt.c +++ b/drivers/watchdog/ib700wdt.c @@ -259,6 +259,7 @@ static const struct file_operations ibwdt_fops = { .llseek = no_llseek, .write = ibwdt_write, .unlocked_ioctl = ibwdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = ibwdt_open, .release = ibwdt_close, }; diff --git a/drivers/watchdog/ibmasr.c b/drivers/watchdog/ibmasr.c index 897f7eda9e6a..4a22fe152086 100644 --- a/drivers/watchdog/ibmasr.c +++ b/drivers/watchdog/ibmasr.c @@ -344,6 +344,7 @@ static const struct file_operations asr_fops = { .llseek = no_llseek, .write = asr_write, .unlocked_ioctl = asr_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = asr_open, .release = asr_release, }; diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c index 550358528084..9857bb74a723 100644 --- a/drivers/watchdog/indydog.c +++ b/drivers/watchdog/indydog.c @@ -152,6 +152,7 @@ static const struct file_operations indydog_fops = { .llseek = no_llseek, .write = indydog_write, .unlocked_ioctl = indydog_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = indydog_open, .release = indydog_release, }; diff --git a/drivers/watchdog/intel_scu_watchdog.c b/drivers/watchdog/intel_scu_watchdog.c index 1c85103b750b..6ad5bf3451ec 100644 --- a/drivers/watchdog/intel_scu_watchdog.c +++ b/drivers/watchdog/intel_scu_watchdog.c @@ -412,6 +412,7 @@ static const struct file_operations intel_scu_fops = { .llseek = no_llseek, .write = intel_scu_write, .unlocked_ioctl = intel_scu_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = intel_scu_open, .release = intel_scu_release, }; diff --git a/drivers/watchdog/iop_wdt.c b/drivers/watchdog/iop_wdt.c index a9ccdb9a9159..6bf68d4750de 100644 --- a/drivers/watchdog/iop_wdt.c +++ b/drivers/watchdog/iop_wdt.c @@ -202,6 +202,7 @@ static const struct file_operations iop_wdt_fops = { .llseek = no_llseek, .write = iop_wdt_write, .unlocked_ioctl = iop_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = iop_wdt_open, .release = iop_wdt_release, }; diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c index 2fe1a3c499ed..2fed40d14007 100644 --- a/drivers/watchdog/it8712f_wdt.c +++ b/drivers/watchdog/it8712f_wdt.c @@ -345,6 +345,7 @@ static const struct file_operations it8712f_wdt_fops = { .llseek = no_llseek, .write = it8712f_wdt_write, .unlocked_ioctl = it8712f_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = it8712f_wdt_open, .release = it8712f_wdt_release, }; diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c index 9067998759e3..09886616fd21 100644 --- a/drivers/watchdog/ixp4xx_wdt.c +++ b/drivers/watchdog/ixp4xx_wdt.c @@ -163,6 +163,7 @@ static const struct file_operations ixp4xx_wdt_fops = { .llseek = no_llseek, .write = ixp4xx_wdt_write, .unlocked_ioctl = ixp4xx_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = ixp4xx_wdt_open, .release = ixp4xx_wdt_release, }; diff --git a/drivers/watchdog/m54xx_wdt.c b/drivers/watchdog/m54xx_wdt.c index 752d03620f0a..22f335e1e164 100644 --- a/drivers/watchdog/m54xx_wdt.c +++ b/drivers/watchdog/m54xx_wdt.c @@ -183,6 +183,7 @@ static const struct file_operations m54xx_wdt_fops = { .llseek = no_llseek, .write = m54xx_wdt_write, .unlocked_ioctl = m54xx_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = m54xx_wdt_open, .release = m54xx_wdt_release, }; diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c index cef2baf59dda..80ff94688487 100644 --- a/drivers/watchdog/machzwd.c +++ b/drivers/watchdog/machzwd.c @@ -361,6 +361,7 @@ static const struct file_operations zf_fops = { .llseek = no_llseek, .write = zf_write, .unlocked_ioctl = zf_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = zf_open, .release = zf_close, }; diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c index a86faa5000f1..d387bad377c4 100644 --- a/drivers/watchdog/mixcomwd.c +++ b/drivers/watchdog/mixcomwd.c @@ -227,6 +227,7 @@ static const struct file_operations mixcomwd_fops = { .llseek = no_llseek, .write = mixcomwd_write, .unlocked_ioctl = mixcomwd_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = mixcomwd_open, .release = mixcomwd_release, }; diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c index 25a92857b217..8aa1cb4a295f 100644 --- a/drivers/watchdog/mtx-1_wdt.c +++ b/drivers/watchdog/mtx-1_wdt.c @@ -181,6 +181,7 @@ static const struct file_operations mtx1_wdt_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .unlocked_ioctl = mtx1_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = mtx1_wdt_open, .write = mtx1_wdt_write, .release = mtx1_wdt_release, diff --git a/drivers/watchdog/mv64x60_wdt.c b/drivers/watchdog/mv64x60_wdt.c index 74bf7144a970..0bc72dd69b70 100644 --- a/drivers/watchdog/mv64x60_wdt.c +++ b/drivers/watchdog/mv64x60_wdt.c @@ -241,6 +241,7 @@ static const struct file_operations mv64x60_wdt_fops = { .llseek = no_llseek, .write = mv64x60_wdt_write, .unlocked_ioctl = mv64x60_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = mv64x60_wdt_open, .release = mv64x60_wdt_release, }; diff --git a/drivers/watchdog/nv_tco.c b/drivers/watchdog/nv_tco.c index 5f0082e300bd..d7a560e348d5 100644 --- a/drivers/watchdog/nv_tco.c +++ b/drivers/watchdog/nv_tco.c @@ -267,6 +267,7 @@ static const struct file_operations nv_tco_fops = { .llseek = no_llseek, .write = nv_tco_write, .unlocked_ioctl = nv_tco_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = nv_tco_open, .release = nv_tco_release, }; diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index 2af1a8b3f973..73fbfc99083b 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c @@ -473,6 +473,7 @@ static const struct file_operations pc87413_fops = { .llseek = no_llseek, .write = pc87413_write, .unlocked_ioctl = pc87413_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = pc87413_open, .release = pc87413_release, }; diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c index c3c93e00b320..7a0587fdc52c 100644 --- a/drivers/watchdog/pcwd.c +++ b/drivers/watchdog/pcwd.c @@ -752,6 +752,7 @@ static const struct file_operations pcwd_fops = { .llseek = no_llseek, .write = pcwd_write, .unlocked_ioctl = pcwd_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = pcwd_open, .release = pcwd_close, }; diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c index e30c1f762045..81508a42a90c 100644 --- a/drivers/watchdog/pcwd_pci.c +++ b/drivers/watchdog/pcwd_pci.c @@ -646,6 +646,7 @@ static const struct file_operations pcipcwd_fops = { .llseek = no_llseek, .write = pcipcwd_write, .unlocked_ioctl = pcipcwd_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = pcipcwd_open, .release = pcipcwd_release, }; diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 6727f8ab2d18..2f44af1831d0 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c @@ -550,6 +550,7 @@ static const struct file_operations usb_pcwd_fops = { .llseek = no_llseek, .write = usb_pcwd_write, .unlocked_ioctl = usb_pcwd_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = usb_pcwd_open, .release = usb_pcwd_release, }; diff --git a/drivers/watchdog/pika_wdt.c b/drivers/watchdog/pika_wdt.c index 205c3c68fca1..a98abd0d3146 100644 --- a/drivers/watchdog/pika_wdt.c +++ b/drivers/watchdog/pika_wdt.c @@ -214,6 +214,7 @@ static const struct file_operations pikawdt_fops = { .release = pikawdt_release, .write = pikawdt_write, .unlocked_ioctl = pikawdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice pikawdt_miscdev = { diff --git a/drivers/watchdog/pnx833x_wdt.c b/drivers/watchdog/pnx833x_wdt.c index aa53babf2bab..4097d076aab8 100644 --- a/drivers/watchdog/pnx833x_wdt.c +++ b/drivers/watchdog/pnx833x_wdt.c @@ -215,6 +215,7 @@ static const struct file_operations pnx833x_wdt_fops = { .llseek = no_llseek, .write = pnx833x_wdt_write, .unlocked_ioctl = pnx833x_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = pnx833x_wdt_open, .release = pnx833x_wdt_release, }; diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c index a8a4b3a41a90..1dfede0abf18 100644 --- a/drivers/watchdog/rc32434_wdt.c +++ b/drivers/watchdog/rc32434_wdt.c @@ -245,6 +245,7 @@ static const struct file_operations rc32434_wdt_fops = { .llseek = no_llseek, .write = rc32434_wdt_write, .unlocked_ioctl = rc32434_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = rc32434_wdt_open, .release = rc32434_wdt_release, }; diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c index 2e608ae6cbc7..57187efeb86f 100644 --- a/drivers/watchdog/rdc321x_wdt.c +++ b/drivers/watchdog/rdc321x_wdt.c @@ -199,6 +199,7 @@ static const struct file_operations rdc321x_wdt_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .unlocked_ioctl = rdc321x_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = rdc321x_wdt_open, .write = rdc321x_wdt_write, .release = rdc321x_wdt_release, diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index b35f7be20c00..dc3c06a92f93 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c @@ -163,6 +163,7 @@ static const struct file_operations riowd_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .unlocked_ioctl = riowd_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = riowd_open, .write = riowd_write, .release = riowd_release, diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c index cbd8c957182f..9b93be00109f 100644 --- a/drivers/watchdog/sa1100_wdt.c +++ b/drivers/watchdog/sa1100_wdt.c @@ -141,6 +141,7 @@ static const struct file_operations sa1100dog_fops = { .llseek = no_llseek, .write = sa1100dog_write, .unlocked_ioctl = sa1100dog_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = sa1100dog_open, .release = sa1100dog_release, }; diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c index 202fc8d8ca5f..da2dad00d473 100644 --- a/drivers/watchdog/sb_wdog.c +++ b/drivers/watchdog/sb_wdog.c @@ -237,6 +237,7 @@ static const struct file_operations sbwdog_fops = { .llseek = no_llseek, .write = sbwdog_write, .unlocked_ioctl = sbwdog_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = sbwdog_open, .release = sbwdog_release, }; diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c index c3151642694c..f2cbe6d880a8 100644 --- a/drivers/watchdog/sbc60xxwdt.c +++ b/drivers/watchdog/sbc60xxwdt.c @@ -280,6 +280,7 @@ static const struct file_operations wdt_fops = { .open = fop_open, .release = fop_close, .unlocked_ioctl = fop_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice wdt_miscdev = { diff --git a/drivers/watchdog/sbc7240_wdt.c b/drivers/watchdog/sbc7240_wdt.c index 12cdee7d5069..0bf583b76e6b 100644 --- a/drivers/watchdog/sbc7240_wdt.c +++ b/drivers/watchdog/sbc7240_wdt.c @@ -211,6 +211,7 @@ static const struct file_operations wdt_fops = { .open = fop_open, .release = fop_close, .unlocked_ioctl = fop_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice wdt_miscdev = { diff --git a/drivers/watchdog/sbc_epx_c3.c b/drivers/watchdog/sbc_epx_c3.c index 86828c28843f..5e3a9ddb952e 100644 --- a/drivers/watchdog/sbc_epx_c3.c +++ b/drivers/watchdog/sbc_epx_c3.c @@ -156,6 +156,7 @@ static const struct file_operations epx_c3_fops = { .llseek = no_llseek, .write = epx_c3_write, .unlocked_ioctl = epx_c3_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = epx_c3_open, .release = epx_c3_release, }; diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index 3822a60a8d2b..1b20b33879c4 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c @@ -186,6 +186,7 @@ static const struct file_operations fitpc2_wdt_fops = { .llseek = no_llseek, .write = fitpc2_wdt_write, .unlocked_ioctl = fitpc2_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = fitpc2_wdt_open, .release = fitpc2_wdt_release, }; diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c index 960385a766b3..9673eb12dacd 100644 --- a/drivers/watchdog/sc1200wdt.c +++ b/drivers/watchdog/sc1200wdt.c @@ -307,6 +307,7 @@ static const struct file_operations sc1200wdt_fops = { .llseek = no_llseek, .write = sc1200wdt_write, .unlocked_ioctl = sc1200wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = sc1200wdt_open, .release = sc1200wdt_release, }; diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c index a612128c5f80..fbe79bcc9297 100644 --- a/drivers/watchdog/sc520_wdt.c +++ b/drivers/watchdog/sc520_wdt.c @@ -336,6 +336,7 @@ static const struct file_operations wdt_fops = { .open = fop_open, .release = fop_close, .unlocked_ioctl = fop_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice wdt_miscdev = { diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c index 3612f1df381b..83949a385f62 100644 --- a/drivers/watchdog/sch311x_wdt.c +++ b/drivers/watchdog/sch311x_wdt.c @@ -337,6 +337,7 @@ static const struct file_operations sch311x_wdt_fops = { .llseek = no_llseek, .write = sch311x_wdt_write, .unlocked_ioctl = sch311x_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = sch311x_wdt_open, .release = sch311x_wdt_close, }; diff --git a/drivers/watchdog/scx200_wdt.c b/drivers/watchdog/scx200_wdt.c index 46268309ee9b..c94098acb78f 100644 --- a/drivers/watchdog/scx200_wdt.c +++ b/drivers/watchdog/scx200_wdt.c @@ -201,6 +201,7 @@ static const struct file_operations scx200_wdt_fops = { .llseek = no_llseek, .write = scx200_wdt_write, .unlocked_ioctl = scx200_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = scx200_wdt_open, .release = scx200_wdt_release, }; diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c index f5713030d0f7..43de56acd767 100644 --- a/drivers/watchdog/smsc37b787_wdt.c +++ b/drivers/watchdog/smsc37b787_wdt.c @@ -505,6 +505,7 @@ static const struct file_operations wb_smsc_wdt_fops = { .llseek = no_llseek, .write = wb_smsc_wdt_write, .unlocked_ioctl = wb_smsc_wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = wb_smsc_wdt_open, .release = wb_smsc_wdt_release, }; diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c index 6eb5185d6ea6..6b3b667e6f23 100644 --- a/drivers/watchdog/w83877f_wdt.c +++ b/drivers/watchdog/w83877f_wdt.c @@ -304,6 +304,7 @@ static const struct file_operations wdt_fops = { .open = fop_open, .release = fop_close, .unlocked_ioctl = fop_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice wdt_miscdev = { diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c index 16e9cbe72acc..5212e68c6b01 100644 --- a/drivers/watchdog/w83977f_wdt.c +++ b/drivers/watchdog/w83977f_wdt.c @@ -446,6 +446,7 @@ static const struct file_operations wdt_fops = { .llseek = no_llseek, .write = wdt_write, .unlocked_ioctl = wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = wdt_open, .release = wdt_release, }; diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c index 6d2071a0590d..a6925847f76f 100644 --- a/drivers/watchdog/wafer5823wdt.c +++ b/drivers/watchdog/wafer5823wdt.c @@ -230,6 +230,7 @@ static const struct file_operations wafwdt_fops = { .llseek = no_llseek, .write = wafwdt_write, .unlocked_ioctl = wafwdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = wafwdt_open, .release = wafwdt_close, }; diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index dbd2ad4c9294..3858094ca6ba 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -933,6 +933,7 @@ static const struct file_operations watchdog_fops = { .owner = THIS_MODULE, .write = watchdog_write, .unlocked_ioctl = watchdog_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = watchdog_open, .release = watchdog_release, }; diff --git a/drivers/watchdog/wdrtas.c b/drivers/watchdog/wdrtas.c index 6ad7edb4a712..184a06a74f83 100644 --- a/drivers/watchdog/wdrtas.c +++ b/drivers/watchdog/wdrtas.c @@ -472,6 +472,7 @@ static const struct file_operations wdrtas_fops = { .llseek = no_llseek, .write = wdrtas_write, .unlocked_ioctl = wdrtas_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = wdrtas_open, .release = wdrtas_close, }; diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c index 7d278b37e083..f9054cb0f8e2 100644 --- a/drivers/watchdog/wdt.c +++ b/drivers/watchdog/wdt.c @@ -523,6 +523,7 @@ static const struct file_operations wdt_fops = { .llseek = no_llseek, .write = wdt_write, .unlocked_ioctl = wdt_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = wdt_open, .release = wdt_release, }; diff --git a/drivers/watchdog/wdt285.c b/drivers/watchdog/wdt285.c index eb729d704836..e60993d0767e 100644 --- a/drivers/watchdog/wdt285.c +++ b/drivers/watchdog/wdt285.c @@ -181,6 +181,7 @@ static const struct file_operations watchdog_fops = { .llseek = no_llseek, .write = watchdog_write, .unlocked_ioctl = watchdog_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = watchdog_open, .release = watchdog_release, }; diff --git a/drivers/watchdog/wdt977.c b/drivers/watchdog/wdt977.c index 5c52c73e1839..066a4fb4d75b 100644 --- a/drivers/watchdog/wdt977.c +++ b/drivers/watchdog/wdt977.c @@ -422,6 +422,7 @@ static const struct file_operations wdt977_fops = { .llseek = no_llseek, .write = wdt977_write, .unlocked_ioctl = wdt977_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = wdt977_open, .release = wdt977_release, }; diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index 66303ab95685..e528024faa41 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c @@ -566,6 +566,7 @@ static const struct file_operations wdtpci_fops = { .llseek = no_llseek, .write = wdtpci_write, .unlocked_ioctl = wdtpci_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = wdtpci_open, .release = wdtpci_release, }; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index b20228c19ccd..10ba2d9e20bc 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -412,17 +412,6 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN) COMPATIBLE_IOCTL(PPPIOCATTCHAN) COMPATIBLE_IOCTL(PPPIOCGCHAN) COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) -/* Watchdog */ -COMPATIBLE_IOCTL(WDIOC_GETSUPPORT) -COMPATIBLE_IOCTL(WDIOC_GETSTATUS) -COMPATIBLE_IOCTL(WDIOC_GETBOOTSTATUS) -COMPATIBLE_IOCTL(WDIOC_GETTEMP) -COMPATIBLE_IOCTL(WDIOC_SETOPTIONS) -COMPATIBLE_IOCTL(WDIOC_KEEPALIVE) -COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT) -COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT) -COMPATIBLE_IOCTL(WDIOC_SETPRETIMEOUT) -COMPATIBLE_IOCTL(WDIOC_GETPRETIMEOUT) }; /* From patchwork Wed Oct 9 19:10:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175652 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1172267ill; Wed, 9 Oct 2019 12:12:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzM7LKLleYpG9LromBtjNqkSyK3/yXh+a9SbOEBDQOx9d8vPOa/IvzfdPf9UKbi5tVbiFc2 X-Received: by 2002:a17:906:4908:: with SMTP id b8mr4307394ejq.83.1570648360715; Wed, 09 Oct 2019 12:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648360; cv=none; d=google.com; s=arc-20160816; b=Ay+qEVMk3u0H51ID6eemBklK6LQ/WEFznbRJIYYtLvi82gk2GVcl/us+PemDx7xL/l VtXfS6so3gf72YpTvz2vDSrQgn2npbvaSSFqURq7riXBVtcJ277vTAy7/eZ1JNLbdMix bHyRXXO5+NjJovIv1XXnBy4frZS9wIgVkFoSq5H59ga5tlz/rgwe5cd3ZU8C0lIuZZP9 RxDEUvZezAr0iR+LSipuDoSOSIY0v8f8eQSVLaoLXG4EnjA+WsgqkFZHbGSxxliB/yQE rfpzA0UnCg8IXnhecaYwDBv6MocDeoj4bQEjwLAQgZ92pGraj6QU6oPN9pqCOuRhBBBb zPMQ== 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=IRvXDoS1zifv67CXy/JtI+Z8c5kuoc/LG7UW/vN1SPQ=; b=fq7PyBRHIiRDQEvv7dMAyWIEqdJh5TL8iKyy0IfSd9H7ukB5pJwyFFi8EUpCUQgkvJ CNtXpFJ/vWNjmW690f6RXzshpU9KHQXCV79X4cRj0H2OtCiMiZl94xujDdPczKttocwP a+Egb+4rOdDJfmYaQdl9ZbcMLagxKPTTRx6old/b/1/QhnDTb2OaSHX03VjNCe5kx1iQ pUqYlLPKxZzdxBgTb9B9rVXNjedsecCvVK9PwtZiXPU49M/cwO9rlUnSBkhQlHHclYQ+ 9khneBMewESQ8Zi5YSBOVOGb5g3cl6EBRdiIBZRyaS2yEGmmZBt3EGTmvxZEKL8H8e4G 6jBQ== 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 e22si1891941ejm.72.2019.10.09.12.12.40; Wed, 09 Oct 2019 12:12:40 -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 S1732332AbfJITMj (ORCPT + 26 others); Wed, 9 Oct 2019 15:12:39 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:39725 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732022AbfJITLb (ORCPT ); Wed, 9 Oct 2019 15:11:31 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1Ma1oK-1idCOx1GgG-00VwZ9; Wed, 09 Oct 2019 21:11:19 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Steffen Maier , linux-scsi@vger.kernel.org, Doug Gilbert , "James E.J. Bottomley" , "Martin K. Petersen" Subject: [PATCH v6 32/43] compat_ioctl: reimplement SG_IO handling Date: Wed, 9 Oct 2019 21:10:33 +0200 Message-Id: <20191009191044.308087-33-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:9Lan3CbTNW1DttWti80g654pL0EZohQZ5/fSs6vMVrkOPe0wm7i dkgS3xONX3vJj7b50q4/3ifwfCxNfkAdgn5cysVvPu7f7LfJllX9Gri8J3dRsiasXNopZEp ox9rXFP/EIj6bTHLNgvyb4rdraNhIMW0lr+nAH1VKNHJWhdmN9pDvAZO3bx/DUSeiJNLNPN qFLbG5nPPvBOY+CvMCfqg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Vy3QkX8f6mQ=:dWhmrN/ZcGTKpT1LUqMdzp 47hIBlnF/rgLZouOdWXWDmvA7kxnzZ3M9kDPUnXikVdjw28VFM97HZxBQrbt1dl1+tl7x6XsA qbVtdIULgosARAANDA9/8cLg4tsTztITjitBdygUnUbKz2L/F0t9qo1CJvPi6WSyCtSOSGCfn 25uiopb/Krxlf9eHL74G03YEwmAPl9cql6CSt/8NNC29JMc7j+x4FluD1ULqRrnqZOj0dL/oA Y/9VStfc0zwMrJ2pJFmyHyV9hsq9Qw1gbCS/hsg3ZMhowrL94RiyS54RyypkKX9byZHotH8zg dwDTTcVF0OcoI+HxgbMXN7RzWRKE1uODQG0xwugd2mpd8T1ygvXD0K8iS9eo7xd3UqEQn88rs PTEo/ZT4XLpsoqlPatSOJa4ygwpswYyavoVdq7lX1m1ydEq5yrtEumBHw43J4GgL9vxepGwBh QqsqahNT9+LDtlZlA9RWigGdacWC3f9Hr2L4lC9ijH4Lu1JaUITwU2Xw9OF1ePzLFHZSoDxGT rIYEc30NJR9eY8ZhMP8jcDkUSdReg4+V8fXFLJKH6o/u1NsvqlrJtrfXnUxsnQ/bPtR0HQPMS +DZe7fa9db4qQePNh5e73BT5D/4RNMSpBF/UDsgznscZ/WXLi+uCi/OKu1WohxOJZZp+vZKpS STueBHaAHzVnDjNqE0adAYsOzMbrW2dW7FS8ScbgpQatGtsyhKC5a1lZ3Ws0NSyco4xniQoFY 1FQYTfxx8sXsfps6WRzgnUXq0J9V4wNgRFXogu3YbY/2Eet7CmmYmwN3WpyYvCF+HShyQjUhg SXyrcAeSuijoMMiJX+mUDtgEjyNi0l6/VbBXR20x9G6znZjnYXmZ418gJ0x/wX/2AbJpn24yv h8V9SzcT7QHBYGxUnUQg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are two code locations that implement the SG_IO ioctl: the old sg.c driver, and the generic scsi_ioctl helper that is in turn used by multiple drivers. To eradicate the old compat_ioctl conversion handler for the SG_IO command, I implement a readable pair of put_sg_io_hdr() /get_sg_io_hdr() helper functions that can be used for both compat and native mode, and then I call this from both drivers. For the iovec handling, there is already a compat_import_iovec() function that can simply be called in place of import_iovec(). To avoid having to pass the compat/native state through multiple indirections, I mark the SG_IO command itself as compatible in fs/compat_ioctl.c and use in_compat_syscall() to figure out where we are called from. As a side-effect of this, the sg.c driver now also accepts the 32-bit sg_io_hdr format in compat mode using the read/write interface, not just ioctl. This should improve compatiblity with old 32-bit binaries, but it would break if any application intentionally passes the 64-bit data structure in compat mode here. Steffen Maier helped debug an issue in an earlier version of this patch. Cc: Steffen Maier Cc: linux-scsi@vger.kernel.org Cc: Doug Gilbert Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Signed-off-by: Arnd Bergmann --- block/scsi_ioctl.c | 132 ++++++++++++++++++++++++++++++++++-- drivers/scsi/sg.c | 19 +++--- fs/compat_ioctl.c | 148 +---------------------------------------- include/linux/blkdev.h | 2 + lib/iov_iter.c | 1 + 5 files changed, 143 insertions(+), 159 deletions(-) -- 2.20.0 diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index f5e0ad65e86a..650bade5ea5a 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -2,6 +2,7 @@ /* * Copyright (C) 2001 Jens Axboe */ +#include #include #include #include @@ -327,7 +328,14 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, struct iov_iter i; struct iovec *iov = NULL; - ret = import_iovec(rq_data_dir(rq), +#ifdef CONFIG_COMPAT + if (in_compat_syscall()) + ret = compat_import_iovec(rq_data_dir(rq), + hdr->dxferp, hdr->iovec_count, + 0, &iov, &i); + else +#endif + ret = import_iovec(rq_data_dir(rq), hdr->dxferp, hdr->iovec_count, 0, &iov, &i); if (ret < 0) @@ -542,6 +550,122 @@ static inline int blk_send_start_stop(struct request_queue *q, return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data); } +#ifdef CONFIG_COMPAT +struct compat_sg_io_hdr { + compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ + compat_int_t dxfer_direction; /* [i] data transfer direction */ + unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ + unsigned char mx_sb_len; /* [i] max length to write to sbp */ + unsigned short iovec_count; /* [i] 0 implies no scatter gather */ + compat_uint_t dxfer_len; /* [i] byte count of data transfer */ + compat_uint_t dxferp; /* [i], [*io] points to data transfer memory + or scatter gather list */ + compat_uptr_t cmdp; /* [i], [*i] points to command to perform */ + compat_uptr_t sbp; /* [i], [*o] points to sense_buffer memory */ + compat_uint_t timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ + compat_uint_t flags; /* [i] 0 -> default, see SG_FLAG... */ + compat_int_t pack_id; /* [i->o] unused internally (normally) */ + compat_uptr_t usr_ptr; /* [i->o] unused internally */ + unsigned char status; /* [o] scsi status */ + unsigned char masked_status; /* [o] shifted, masked scsi status */ + unsigned char msg_status; /* [o] messaging level data (optional) */ + unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ + unsigned short host_status; /* [o] errors from host adapter */ + unsigned short driver_status; /* [o] errors from software driver */ + compat_int_t resid; /* [o] dxfer_len - actual_transferred */ + compat_uint_t duration; /* [o] time taken by cmd (unit: millisec) */ + compat_uint_t info; /* [o] auxiliary information */ +}; +#endif + +int put_sg_io_hdr(const struct sg_io_hdr *hdr, void __user *argp) +{ +#ifdef CONFIG_COMPAT + if (in_compat_syscall()) { + struct compat_sg_io_hdr hdr32 = { + .interface_id = hdr->interface_id, + .dxfer_direction = hdr->dxfer_direction, + .cmd_len = hdr->cmd_len, + .mx_sb_len = hdr->mx_sb_len, + .iovec_count = hdr->iovec_count, + .dxfer_len = hdr->dxfer_len, + .dxferp = (uintptr_t)hdr->dxferp, + .cmdp = (uintptr_t)hdr->cmdp, + .sbp = (uintptr_t)hdr->sbp, + .timeout = hdr->timeout, + .flags = hdr->flags, + .pack_id = hdr->pack_id, + .usr_ptr = (uintptr_t)hdr->usr_ptr, + .status = hdr->status, + .masked_status = hdr->masked_status, + .msg_status = hdr->msg_status, + .sb_len_wr = hdr->sb_len_wr, + .host_status = hdr->host_status, + .driver_status = hdr->driver_status, + .resid = hdr->resid, + .duration = hdr->duration, + .info = hdr->info, + }; + + if (copy_to_user(argp, &hdr32, sizeof(hdr32))) + return -EFAULT; + + return 0; + } +#endif + + if (copy_to_user(argp, hdr, sizeof(*hdr))) + return -EFAULT; + + return 0; +} +EXPORT_SYMBOL(put_sg_io_hdr); + +int get_sg_io_hdr(struct sg_io_hdr *hdr, const void __user *argp) +{ +#ifdef CONFIG_COMPAT + struct compat_sg_io_hdr hdr32; + + if (in_compat_syscall()) { + if (copy_from_user(&hdr32, argp, sizeof(hdr32))) + return -EFAULT; + + *hdr = (struct sg_io_hdr) { + .interface_id = hdr32.interface_id, + .dxfer_direction = hdr32.dxfer_direction, + .cmd_len = hdr32.cmd_len, + .mx_sb_len = hdr32.mx_sb_len, + .iovec_count = hdr32.iovec_count, + .dxfer_len = hdr32.dxfer_len, + .dxferp = compat_ptr(hdr32.dxferp), + .cmdp = compat_ptr(hdr32.cmdp), + .sbp = compat_ptr(hdr32.sbp), + .timeout = hdr32.timeout, + .flags = hdr32.flags, + .pack_id = hdr32.pack_id, + .usr_ptr = compat_ptr(hdr32.usr_ptr), + .status = hdr32.status, + .masked_status = hdr32.masked_status, + .msg_status = hdr32.msg_status, + .sb_len_wr = hdr32.sb_len_wr, + .host_status = hdr32.host_status, + .driver_status = hdr32.driver_status, + .resid = hdr32.resid, + .duration = hdr32.duration, + .info = hdr32.info, + }; + + return 0; + } +#endif + + if (copy_from_user(hdr, argp, sizeof(*hdr))) + return -EFAULT; + + return 0; +} +EXPORT_SYMBOL(get_sg_io_hdr); + int scsi_cmd_ioctl(struct request_queue *q, struct gendisk *bd_disk, fmode_t mode, unsigned int cmd, void __user *arg) { @@ -581,14 +705,14 @@ int scsi_cmd_ioctl(struct request_queue *q, struct gendisk *bd_disk, fmode_t mod case SG_IO: { struct sg_io_hdr hdr; - err = -EFAULT; - if (copy_from_user(&hdr, arg, sizeof(hdr))) + err = get_sg_io_hdr(&hdr, arg); + if (err) break; err = sg_io(q, bd_disk, &hdr, mode); if (err == -EFAULT) break; - if (copy_to_user(arg, &hdr, sizeof(hdr))) + if (put_sg_io_hdr(&hdr, arg)) err = -EFAULT; break; } diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index cce757506383..8ae096af2667 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -447,8 +447,7 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) retval = -ENOMEM; goto free_old_hdr; } - retval =__copy_from_user - (new_hdr, buf, SZ_SG_IO_HDR); + retval = get_sg_io_hdr(new_hdr, buf); req_pack_id = new_hdr->pack_id; kfree(new_hdr); if (retval) { @@ -589,10 +588,7 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) } if (hp->masked_status || hp->host_status || hp->driver_status) hp->info |= SG_INFO_CHECK; - if (copy_to_user(buf, hp, SZ_SG_IO_HDR)) { - err = -EFAULT; - goto err_out; - } + err = put_sg_io_hdr(hp, buf); err_out: err2 = sg_finish_rem_req(srp); sg_remove_request(sfp, srp); @@ -735,7 +731,7 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf, } srp->sg_io_owned = sg_io_owned; hp = &srp->header; - if (__copy_from_user(hp, buf, SZ_SG_IO_HDR)) { + if (get_sg_io_hdr(hp, buf)) { sg_remove_request(sfp, srp); return -EFAULT; } @@ -1797,7 +1793,14 @@ sg_start_req(Sg_request *srp, unsigned char *cmd) struct iovec *iov = NULL; struct iov_iter i; - res = import_iovec(rw, hp->dxferp, iov_count, 0, &iov, &i); +#ifdef CONFIG_COMPAT + if (in_compat_syscall()) + res = compat_import_iovec(rw, hp->dxferp, iov_count, + 0, &iov, &i); + else +#endif + res = import_iovec(rw, hp->dxferp, iov_count, + 0, &iov, &i); if (res < 0) return res; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 10ba2d9e20bc..f279e77df256 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -64,151 +64,6 @@ static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } #ifdef CONFIG_BLOCK -typedef struct sg_io_hdr32 { - compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ - compat_int_t dxfer_direction; /* [i] data transfer direction */ - unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ - unsigned char mx_sb_len; /* [i] max length to write to sbp */ - unsigned short iovec_count; /* [i] 0 implies no scatter gather */ - compat_uint_t dxfer_len; /* [i] byte count of data transfer */ - compat_uint_t dxferp; /* [i], [*io] points to data transfer memory - or scatter gather list */ - compat_uptr_t cmdp; /* [i], [*i] points to command to perform */ - compat_uptr_t sbp; /* [i], [*o] points to sense_buffer memory */ - compat_uint_t timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ - compat_uint_t flags; /* [i] 0 -> default, see SG_FLAG... */ - compat_int_t pack_id; /* [i->o] unused internally (normally) */ - compat_uptr_t usr_ptr; /* [i->o] unused internally */ - unsigned char status; /* [o] scsi status */ - unsigned char masked_status; /* [o] shifted, masked scsi status */ - unsigned char msg_status; /* [o] messaging level data (optional) */ - unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ - unsigned short host_status; /* [o] errors from host adapter */ - unsigned short driver_status; /* [o] errors from software driver */ - compat_int_t resid; /* [o] dxfer_len - actual_transferred */ - compat_uint_t duration; /* [o] time taken by cmd (unit: millisec) */ - compat_uint_t info; /* [o] auxiliary information */ -} sg_io_hdr32_t; /* 64 bytes long (on sparc32) */ - -typedef struct sg_iovec32 { - compat_uint_t iov_base; - compat_uint_t iov_len; -} sg_iovec32_t; - -static int sg_build_iovec(sg_io_hdr_t __user *sgio, void __user *dxferp, u16 iovec_count) -{ - sg_iovec_t __user *iov = (sg_iovec_t __user *) (sgio + 1); - sg_iovec32_t __user *iov32 = dxferp; - int i; - - for (i = 0; i < iovec_count; i++) { - u32 base, len; - - if (get_user(base, &iov32[i].iov_base) || - get_user(len, &iov32[i].iov_len) || - put_user(compat_ptr(base), &iov[i].iov_base) || - put_user(len, &iov[i].iov_len)) - return -EFAULT; - } - - if (put_user(iov, &sgio->dxferp)) - return -EFAULT; - return 0; -} - -static int sg_ioctl_trans(struct file *file, unsigned int cmd, - sg_io_hdr32_t __user *sgio32) -{ - sg_io_hdr_t __user *sgio; - u16 iovec_count; - u32 data; - void __user *dxferp; - int err; - int interface_id; - - if (get_user(interface_id, &sgio32->interface_id)) - return -EFAULT; - if (interface_id != 'S') - return do_ioctl(file, cmd, (unsigned long)sgio32); - - if (get_user(iovec_count, &sgio32->iovec_count)) - return -EFAULT; - - { - void __user *top = compat_alloc_user_space(0); - void __user *new = compat_alloc_user_space(sizeof(sg_io_hdr_t) + - (iovec_count * sizeof(sg_iovec_t))); - if (new > top) - return -EINVAL; - - sgio = new; - } - - /* Ok, now construct. */ - if (copy_in_user(&sgio->interface_id, &sgio32->interface_id, - (2 * sizeof(int)) + - (2 * sizeof(unsigned char)) + - (1 * sizeof(unsigned short)) + - (1 * sizeof(unsigned int)))) - return -EFAULT; - - if (get_user(data, &sgio32->dxferp)) - return -EFAULT; - dxferp = compat_ptr(data); - if (iovec_count) { - if (sg_build_iovec(sgio, dxferp, iovec_count)) - return -EFAULT; - } else { - if (put_user(dxferp, &sgio->dxferp)) - return -EFAULT; - } - - { - unsigned char __user *cmdp; - unsigned char __user *sbp; - - if (get_user(data, &sgio32->cmdp)) - return -EFAULT; - cmdp = compat_ptr(data); - - if (get_user(data, &sgio32->sbp)) - return -EFAULT; - sbp = compat_ptr(data); - - if (put_user(cmdp, &sgio->cmdp) || - put_user(sbp, &sgio->sbp)) - return -EFAULT; - } - - if (copy_in_user(&sgio->timeout, &sgio32->timeout, - 3 * sizeof(int))) - return -EFAULT; - - if (get_user(data, &sgio32->usr_ptr)) - return -EFAULT; - if (put_user(compat_ptr(data), &sgio->usr_ptr)) - return -EFAULT; - - err = do_ioctl(file, cmd, (unsigned long) sgio); - - if (err >= 0) { - void __user *datap; - - if (copy_in_user(&sgio32->pack_id, &sgio->pack_id, - sizeof(int)) || - get_user(datap, &sgio->usr_ptr) || - put_user((u32)(unsigned long)datap, - &sgio32->usr_ptr) || - copy_in_user(&sgio32->status, &sgio->status, - (4 * sizeof(unsigned char)) + - (2 * sizeof(unsigned short)) + - (3 * sizeof(int)))) - err = -EFAULT; - } - - return err; -} - struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */ char req_state; char orphan; @@ -358,6 +213,7 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) #endif #ifdef CONFIG_BLOCK /* SG stuff */ +COMPATIBLE_IOCTL(SG_IO) COMPATIBLE_IOCTL(SG_SET_TIMEOUT) COMPATIBLE_IOCTL(SG_GET_TIMEOUT) COMPATIBLE_IOCTL(SG_EMULATED_HOST) @@ -435,8 +291,6 @@ static long do_ioctl_trans(unsigned int cmd, case PPPIOCSACTIVE32: return ppp_sock_fprog_ioctl_trans(file, cmd, argp); #ifdef CONFIG_BLOCK - case SG_IO: - return sg_ioctl_trans(file, cmd, argp); case SG_GET_REQUEST_TABLE: return sg_grt_trans(file, cmd, argp); #endif diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index f3ea78b0c91c..2c8cd22b176b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -870,6 +870,8 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, unsigned int, void __user *); extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, struct scsi_ioctl_command __user *); +extern int get_sg_io_hdr(struct sg_io_hdr *hdr, const void __user *argp); +extern int put_sg_io_hdr(const struct sg_io_hdr *hdr, void __user *argp); extern int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags); extern void blk_queue_exit(struct request_queue *q); diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 639d5e7014c1..ffb52f2c0ef4 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1678,6 +1678,7 @@ ssize_t compat_import_iovec(int type, *iov = p == *iov ? NULL : p; return n; } +EXPORT_SYMBOL(compat_import_iovec); #endif int import_single_range(int rw, void __user *buf, size_t len, From patchwork Wed Oct 9 19:10:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175655 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1172721ill; Wed, 9 Oct 2019 12:13:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxd/fDQkVXoaArEIuEjuDN1NKdQM971D0XNgLtv9ld3cW0K6Je98hbyYWZBZWAb1WbQ3oxy X-Received: by 2002:a05:6402:3054:: with SMTP id bu20mr4272200edb.97.1570648382466; Wed, 09 Oct 2019 12:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648382; cv=none; d=google.com; s=arc-20160816; b=qww9HaJQ+sIJUWoBMJDvjMXavQzVQAgoxz+4SFkom8orcOCtRKgyhEzgWQgVeb4ak2 +UdrycxKJ1PgzeWkh+t+PMKShsEhNV2GtXHAcx2MwbtPqBKNUSgWJ6aLi8MLsgkPtf2s Q475aRyXv+pU3zIXFpGDxAGW6Zd+JtXKgmge9Us4e+FFEL8VlVU/4Hl6NiCDgDkjRTaL suGF2987czlgetQuV6PxMRpzPaTOJrbShzULEpG484h3l9k7cPOgQ61n3Y4bgN0p9wZm JvaaJeMrTuCEghdJ206h81fpWDDWQJGibN9TwM9FYjAZc3b44gAl27CxAlkHYaja23Q6 hBkw== 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=FCKu/F5Sjc/+8LMWoPoXHI0+/xXOvFO+hdDhzvBRaj4=; b=HOS9U7kzbpb1IYXbvvmrrrSqu5GXej4/E8uEY2FwB4CJqzOHNzqFGYFVZeTy6wCp4/ OLQC/YfyMWvA8HR1eRq0sQBK9bo1YUNcEv7ubd1ZmtcqpDZVB346cOO8R6IdfrWkpdfm hwrPUntaB97mW5wnJ3Z+XnRPRQMbLtJreZlCgKwfrzzFrRNjSQ29nj6PhkwfOVBH6hvO RmYuswE6n2oN7sZvOPdi9klNpwenCFPZZE+OMQ5er6cOkA5TNuHj0cRFSeV9Fuz+Cs3l BpKbb6fyS6wX9dktFvxphh/Mw2f/HYfyo826TvJXHSD7llxnnnlf6dVRvBVVBf2aJrFF ogDA== 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 y10si1671077ejw.76.2019.10.09.12.13.02; Wed, 09 Oct 2019 12:13:02 -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 S1732380AbfJITNB (ORCPT + 26 others); Wed, 9 Oct 2019 15:13:01 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:40875 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732023AbfJITL3 (ORCPT ); Wed, 9 Oct 2019 15:11:29 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M1q8m-1iG5Vf2T6m-002IBj; Wed, 09 Oct 2019 21:11:19 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet Subject: [PATCH v6 33/43] af_unix: add compat_ioctl support Date: Wed, 9 Oct 2019 21:10:34 +0200 Message-Id: <20191009191044.308087-34-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:3hdG2mB6y44B0lENsOLf+2JDxXb3GxKb0/+ZwQvy3N3s/s32/P5 vsJoA/nDkhpGhYQ9IuXvMf0Od0U3+NdvFgjzguncjWj0z/nmTWr97Eu7GcWyY/BsZJ7IohE SMbRsEA/pHwT6+RczHlwA+6AEGP6XoJ45JRmyVUF48tW2+sZZMIbmTegWuZER9d2onWnhfB D+6vZRCHykJ9r3s6EFVQw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:QExA1yG/mEs=:1iv7z69M91ozcpEzAcJS8N D5/hPa9khNPOhB1vQ3baDoXoQNI9zNUTMPFc5/itQLeOe7xPmYf4xU6zlKHp8HVjuApbFlvyO THVFT2YBcMFj1kuCAg3KvZB/aowFwzwk5b7sQjQPHBJmF+fxyHQc6moNhH0O8HjJaulu0M+RF xXaF5TFpzThh2tNgxcuLb6TvxnjUxvVaiZ27rOxPTPl9YEB4BSAHc7eWfeWNs9jFDK8jNjjMs eld/n5aprDQILq4LI+aWbemj9Exx+5G7i8OBPa7twZ+AghEra2W5gD7fPTaX7zFiAY5mdihpK FmSBuo18Rd+2SkTpvLkoRfzqr1VZBE9jXUAHXe0dfA3dt3ysA5mq6anQQnQmz5z4cImFOJIXb bOxUXbTlkMSi4uNXnKyMMIslYlyIhqAXKqtmnpyzmE4jD03W+1kgSDnp1lVu4HiFLs2oBFi6z WEzeBrdM7jZwMv74jcLjqDnMyfcgfLyURFnLVNqVyQNooembPsC0nmMYVJY2d4fX0xSaumoNn sz3V4LgAgz2NSzQtfRKp5I5wxGdIbGVrbrQJTrhnzb83hSy4WDExPiLqalLUS/MQoCl9OkiBA fnlEQASdMV2M3OVOc7JLjQow8u/zWNMXH3E4sxWixvU+8VDQDmyCJsFb9QFxOWnMutD1dCNU7 ae6hhCSpKQcRyv2K+af5J2GvLRxgS3UWgAR6EMwyKKmFNp//ISdyMBXzRUiaZLU213o0IcIdJ ryA9pBI7Jap+K5zCheTsYPCDOursm+jghdTRfI/3wPN6nUGXzevhieyzjKjwOoRC/1lvnhGYw Ix6OlgQFLR3wRUxaP5PWn3D5jJvCfLDTPjsX1hDdkFIxj4gYvuKKifGLDnvk5aUtQPEamMWJh nzCyruV5Ic0y0PYj9Cug== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: ba94f3088b79 ("unix: add ioctl to open a unix socket file with O_PATH") Cc: netdev@vger.kernel.org Cc: "David S. Miller" Cc: Eric Dumazet Signed-off-by: Arnd Bergmann --- net/unix/af_unix.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.20.0 diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 67e87db5877f..e18ca6d9f3d4 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -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; From patchwork Wed Oct 9 19:10:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175648 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171694ill; Wed, 9 Oct 2019 12:12:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUynVaGsT16z1bThh9u8eg95sKF2mlAcGhZdyztE4yAMQpmvzHd82e3EVDMeJCwflhYlAp X-Received: by 2002:a17:906:4e92:: with SMTP id v18mr4281254eju.242.1570648332526; Wed, 09 Oct 2019 12:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648332; cv=none; d=google.com; s=arc-20160816; b=QrwBLYuEm40SeqGVfXijxByDHS9SZj//+/UaAUVz6QzTypo5JSHANixb4s+5aCaupI FavrsX31Q7A+AzlYiwFrfoNIrtpvSiaG1gpSXmwXdRD+NHD0X0o7fnhuWA9uW4VgUXaq /dLCbGpwPeRc0gXQbu8TBIUaYTU/UdD9gqjrrkjL38NYscKwVry1xa7xT9oHzmDtRy2l d+C1NdfCSEt4cQe3fgwJP3VLad5EcgLb+iUXa1Vs39Ul+Pc8Bzxk3O1aO4aJLM90f+R9 8G/GGqyS9AyhFExJ3a3XA5DSajnLf7R8/jX1UOKI4ESx71uBXKRylQdDYH20qknamj7c Ig+w== 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=d+tRMb8OUyKpWtjZ8a2cJziTxAog7pgM955aYDCRuI0=; b=LfzYeRYGEC6Ta3b8jT6fd7uagCzQfMSzIVFDA97aF5Yn3+Wy86rwZFDKkiy1PBgmip 9VpNIhY4yhbSLXU3tsQ82nhfHeFtLsnI0G1QjTFnA+Y5LEQcErM0yAtU84Rq4W3KWrul eRIa6NgN3UmuCxGmPwtPptQV2awreJu9C5oQH0/BJbwCvuPI2I9KO5jJsGyVwz6Ml+ol HBeayYe3tMVH9GJiVgyQHJPRTnYHSobGTuj4flCn6oS+iyzsO5C3aV23b390qq4HsIH/ TDh2q3JSr1p7iWcuVfXfmqCm0OgLPrgzPuGSQex1F6+mmafUDQlaoVt/dzHzBga1F0Hl uwEQ== 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 m1si1796997ejb.44.2019.10.09.12.12.12; Wed, 09 Oct 2019 12:12:12 -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 S1732113AbfJITLf (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:35 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:56199 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731824AbfJITL1 (ORCPT ); Wed, 9 Oct 2019 15:11:27 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N8oOk-1i3afR3chC-015pLd; Wed, 09 Oct 2019 21:11:20 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Eric Dumazet , netdev@vger.kernel.org, "David S. Miller" Subject: [PATCH v6 34/43] compat_ioctl: handle SIOCOUTQNSD Date: Wed, 9 Oct 2019 21:10:35 +0200 Message-Id: <20191009191044.308087-35-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:uemQDqA8yQ6MG7MO2w2hB7mLVVCYHFMtePKjKuwvfP+fKw479wi +3XH2jpG2j8lBDQxUHlpmJugPSEVHS4OBNcQQA0NBvEAx6hzxafXBAI2rIJOiSHd0Arteyp h8w7y6xun7yngr4VavE/jm0+bod5rapG7AgX0+V0MVAbkqWohYWJZroUHvaveum+3A13lwE P3MRbIbyNK22sOumQLM8Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:jCWR5TpYalo=:JEiqSw2ynBAY/yIo966rNk okajkQuPa+YtaOW3JvOQHr+J6t8i2U/E4DRyD7qU9Ft7WHk+5KHDWKi9OdMFrr5DNtmbNju8D 6H0QHl4hlMfud+pWBSsw9QVG5J5Ri4meSjWM3ZwSZpsgXizmK6bS7m+FTQxmPWgLml8oyxO3N 9V+iyQjFE7BvalkRhehCpZqW3nNDJ/0I0/K1KDXVTCRi5AGqLCbDV0p15Vre6MgNgkIVEE1EH p5cpk/NEyWW7OdKW2VrazYGL8xfVB7cy7zTrvynJQGjUIUOMNnJP1BNg/+OZccrThMqnA8uCV sdGpN2tJxi39qlX+cqcgRqtkzTXxRrEaGAaL19qWhfnLJRUovmlrtiNyEHdMisOtodXqIcBcT xQpN1lTgYPOGorSDbBasrYiwhCEmiLOhxMEXiRzerRza0j+43fYSp86LEtJXdFI50q51Gz7km iCe+h8m8pMU+xDFOm24REu5YOnyVUeqUZluBytLM6HZCeoop0nMMMz9BlDAJEc4wh+fD1ostO nGlel+ejpQxWbR1V69v8cZIPTG4LVMtI3iERXe9SDeVyyL6YJyAtDCfKJYrslnC5lfqq2eEwL 7ADmRETHmHk3FEubMm/ESuUxcC7H7vRpxbTRD74H4fQufRgTlmagVPaqZ/u4SfbE6XJY91cw1 O5jVvINrL+juEKnOMyYYQOgI1tiDx273l5T+B5gVZX5jPMjUpChv+6KqqnnSxmHdedN7nT2K5 HbfNwN6FIlcvrqnbAw2gYkDwTwSmzsDiUlvrrlvynVt4uy7E9/czPv8DIL76UJQgQYuB4S33J 9KvWA4DH/RO8FAbFVMoqgC8sNNmMyqOeIJ9FW0v17DZoX5xEU7WbvVbexDdpLX/cp6tvl+N3s 3Y7W252bI8BKRpjTbgXQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unlike the normal SIOCOUTQ, SIOCOUTQNSD was never handled in compat mode. Add it to the common socket compat handler along with similar ones. Fixes: 2f4e1b397097 ("tcp: ioctl type SIOCOUTQNSD returns amount of data not sent") Cc: Eric Dumazet Cc: netdev@vger.kernel.org Cc: "David S. Miller" Signed-off-by: Arnd Bergmann --- net/socket.c | 1 + 1 file changed, 1 insertion(+) -- 2.20.0 diff --git a/net/socket.c b/net/socket.c index 6a9ab7a8b1d2..a60f48ab2130 100644 --- a/net/socket.c +++ b/net/socket.c @@ -3452,6 +3452,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, case SIOCSARP: case SIOCGARP: case SIOCDARP: + case SIOCOUTQNSD: case SIOCATMARK: return sock_do_ioctl(net, sock, cmd, arg); } From patchwork Wed Oct 9 19:10:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175645 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171461ill; Wed, 9 Oct 2019 12:12:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwq06ko/CtyqwDNQ4MZb967QCWIDU59Gz4y0bEiiaD5BadlVB1TDVpMJk/5T3mfcEmISvZk X-Received: by 2002:a17:906:6b99:: with SMTP id l25mr4250182ejr.233.1570648321327; Wed, 09 Oct 2019 12:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648321; cv=none; d=google.com; s=arc-20160816; b=qyQRZfD4Fh7rHltTDor4CAJPHZEninuq0ZnzhswjUeDYacaG4mTdo23BzhsDzEFLHj zCFlJFyv72R2dOlY8aQJi8FHR5NWSK8VMKJrp21Jq9sjZCibWomhNDco78ZSnyvbCu0D zAibDZj7E7UJt/RzOoPI9IibPZLbh39SmmGTZgUA/W+XP/a/DJuwcSx7a7DBmL5SlW9F 1G4NC4aw7Zs80/vMiwlEbL4WY8UBr4TB9FWdy3nCrPkkBo0SdcxSQ9o7oJiuGbSFSppA omu+wILheSbt4H6+XSDOZfj844nf63PWo5OQA0YjlWbyB5XWcx8SsOwA4WnLv+gtcGQ7 zw7g== 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=INDJD2br6XxXffY0jysQGGR2wgNu0wyKGAefQIZNvWk=; b=KDVi495QOKHuSQCbRK+2dHYOwKWSRtESPcbNXV0wVpYNQopc0uRRgMaM/FA+JxxegO ufUC/cPWyK9O1GeE72cmYQoY0jI53D1R+SAQ0ptkvK7VUDLHVNanQcLGBzn2Axr5d4GS 8P15DMHBzp172pGvSm8Q1rCMIDEd+4hqtNyrpZNgoWYlEwtrzrIBoQSPjDSVVkOu6QSH rsEUBcDLEKr2OhR2HCkIBXPiWJQO/+Yis13sQWQAuEHD9PUGf3GmRle/kWOCVkl9awGY uv9ffchjYtxnwZOGx622Yyd5D7F7T5ORmgeuWyWw7taQXTczMEh6RT3cuZYqtBbwdY1J v2VQ== 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 gh16si1676469ejb.150.2019.10.09.12.12.01; Wed, 09 Oct 2019 12:12:01 -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 S1732139AbfJITLj (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:39 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:44457 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732017AbfJITL2 (ORCPT ); Wed, 9 Oct 2019 15:11:28 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M9FSx-1iCUjn0qkZ-006OvI; Wed, 09 Oct 2019 21:11:20 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , Eric Dumazet , netdev@vger.kernel.org, "David S. Miller" Subject: [PATCH v6 35/43] compat_ioctl: move SIOCOUTQ out of compat_ioctl.c Date: Wed, 9 Oct 2019 21:10:36 +0200 Message-Id: <20191009191044.308087-36-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Gs7WDz3cO6L34SuxnoUE0cPkG0RD46UJTcOdAtxxQ1wu2AcocIH MLlyJRAJ8Q6F2FRZDhUczb7xeo7VKSoS7S+r2JbhUK30znZWrAwlwhfU4RweQnK7sx89S/8 s9RgheEsez9Uomff7IBT9Sltreuq64VyHWryfBMeRfUyAETmwTP08msug+UQKLwvT+1trrR Sv2dxjAVq0UUbeHAemB7A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:HtEfBJfsbxY=:E7oDDRVKYPFRpr3roXuDJ9 2a2dn8t9obGYSTPEUnz0t2K7GmIT/1+xA4ovsqk8Kur9QPB3c2IahhiyJmSHQFl4cZeSQryh1 AqIQTSi1rtujSBNrlmRp25g3/c5MpZn/qJd/Qonjsru6QuxeC1LLH0STtADZWKJZZ1Q9bAE95 RyKLn27ZRIaGPKzydfxflDf7+3EsMKNPB3UhsQn6vFpePJRnECESmuJa+f9xYFNHFpU9uwYZi 8k3POEKOCWbpWR7zINsvobTBZyqqKLDMpzlwVMPvftpTSw4BSRgCuATpj91oot5bPoKx0dVlI sOi67TGH6EqbrjBpIdl1HouxucUq9EuTT/5Hg6ohtbixGME8ADJR/Csf1eotQ2+xegqcY0MtE yOGlP3sSO+h/kSukU4ciwdDF6FEHJaFfp8i+ZWFhL824kNU52oi3hdvGjfAF1WWmSsPVA88Xc C/tJxGlyCGVHHbNeSzlVCR5xR8QLmke8AJOl9ahbVfSzjO1uFyjkCPngHAolmpzo/f36GFNpq 859XoS3QmUTOTZelYbFxGHLIsWA9bv/VNdg0cPP9wMW2Mg/hciK9h/86S9IaNBMOtyoR5g5yT PiCQwLHwcO/BycittMlz18e/6U1WgGzo6/SC542+TCVdLdXDv3G/9zXq/8p5fZ/ITYV1mWWZn Ct1DOaLHindVluRUugzQATVjV+lZGY+SGzzTFJaKmIRwtxzHu1kQKPXWuE/FjTSkzj0hcNhFk DE/WbvWIp6lSX+XlJ72O7pZFCjLwn2fZJQuayRTVm4Ijs/pEb6NqkyK2XbPfJZV29hXL/m9cx iOt3ysUxL08uOJqtj170VNDhNlkArXK02ON+8NeK+ohY/C7n7W2zmowIUXxtdUmuAZWU7vLC5 2dE4A/lwcI0iwAAG5Ssg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All users of this call are in socket or tty code, so handling it there means we can avoid the table entry in fs/compat_ioctl.c. Reviewed-by: Greg Kroah-Hartman Cc: Eric Dumazet Cc: netdev@vger.kernel.org Cc: "David S. Miller" Signed-off-by: Arnd Bergmann --- drivers/tty/tty_io.c | 1 + fs/compat_ioctl.c | 2 -- net/socket.c | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 802c1210558f..c09691b20a25 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2755,6 +2755,7 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd, int retval = -ENOIOCTLCMD; switch (cmd) { + case TIOCOUTQ: case TIOCSTI: case TIOCGWINSZ: case TIOCSWINSZ: diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index f279e77df256..d537888f3660 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -198,8 +198,6 @@ static int ppp_scompress(struct file *file, unsigned int cmd, #define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd), static unsigned int ioctl_pointer[] = { -/* Little t */ -COMPATIBLE_IOCTL(TIOCOUTQ) #ifdef CONFIG_BLOCK /* Big S */ COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN) diff --git a/net/socket.c b/net/socket.c index a60f48ab2130..371999a024fa 100644 --- a/net/socket.c +++ b/net/socket.c @@ -100,6 +100,7 @@ #include #include #include +#include #include #include #include @@ -3452,6 +3453,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, case SIOCSARP: case SIOCGARP: case SIOCDARP: + case SIOCOUTQ: case SIOCOUTQNSD: case SIOCATMARK: return sock_do_ioctl(net, sock, cmd, arg); From patchwork Wed Oct 9 19:10:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175660 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1173471ill; Wed, 9 Oct 2019 12:13:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLm9nDGHXZcQXaTdCdpT3akgvUUKQSxQPOmHnJ0GtNd5NmgoXvQR/rHGQrPeKkkPbEtZIQ X-Received: by 2002:a05:6402:1804:: with SMTP id g4mr4493695edy.266.1570648421087; Wed, 09 Oct 2019 12:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648421; cv=none; d=google.com; s=arc-20160816; b=k2q4p+ve9MD/peORfZ0I/njCpVUo3491UuqPAGp3E8fbABIb4E8LW2XfkaaEhl5yby pMF3YjHTjRf6qv+j19d6Ybs07GmrD/cey+9KrTomenvvCcOi9LbFv//Kwi/PUVp/Tfnc Fu70WijWoG0l4qEwswXmUTZb+ySJE3btDPfdkFiMu/hpN/vLY94mukDj1GQOdPdCGQnn U1Pr4ja09ckOQnMAGbZ5hU5oiVJRSHjZ98DpE9FgayYYztxppsqn9zTWbW+8EXpy4GYx edqGfJQINeMs+ZYj9zlKYc5N7bWP8XfLzOHfWVsKQjz31V5t0kw7VHhH3t4DWdddzDb5 aBRA== 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=AjQi6fQkMt0fXMd+va5C4jf8zZSW2kLWvmV/pkeg3xg=; b=JZ/YpaegSfp6tGIxUzyNn5Z7HIx/oWCyWcY8tB8din1YjQoauiS7CJQq1jt+6naAlL fYF7tcOvTvQRcW8J8s3BJBOPffys98bqoYYNAtKtbTcFXI9LZxboSw8SmxXuZzXGKTJV cRmkdEHukPmBQxF6mRkdknQ4WCdaydJFR4dgw722sX6IPepsAmCtC4nkH278JT2GRg39 8vhhv3ogz8ERialkc2tgeiaqZK2JBLY/7QHORWO8EqOv4MyEwDSEBTiW1ORmrBjHklNY 7LmbXml/OxwnPRbOej3LICDKMkCP/IMUD5NLv2JT/ehzVXJ22EEWAYXgcatww9Tvr2OK 4G5Q== 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 f23si1604713eji.266.2019.10.09.12.13.40; Wed, 09 Oct 2019 12:13:41 -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 S1732450AbfJITNk (ORCPT + 26 others); Wed, 9 Oct 2019 15:13:40 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:59653 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731968AbfJITLW (ORCPT ); Wed, 9 Oct 2019 15:11:22 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N5VXu-1i2Ujq2Hqk-016vHR; Wed, 09 Oct 2019 21:11:20 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , Paul Mackerras Subject: [PATCH v6 36/43] tty: handle compat PPP ioctls Date: Wed, 9 Oct 2019 21:10:37 +0200 Message-Id: <20191009191044.308087-37-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:43BP+32+2SiwTrW6MHUM/okhpG3+oHxC7RcOSEJIqMvz5OLkUqt 4/etTty+G8dCqllqFpFIPxLDCLHphxe0yjLccmA9PMIloSi4DvuMfEWE+N9gX0loKtl12KN e2rIOaV9KpRmAdGGcnVEWrBiQ0lG5bqZodCI5jWL9IINqIFdiDQmwA7Ho6rWDHEHg3gBxjT M+ZwTu5E43IV5LS9jLXww== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:gtDDUaRl35U=:cNNhWfh43v/g15sk9Sw8Jk qJ0JStosDeWOibvIqepXRzxCr/5DpPxW6r8CBD7JouAQn+zp7ipRB3BJ8bLu4dsRzmWoZ/Vsc ujtTtGIT5tCt16EADFOYAfScuXBkuSEKcFjvqKA0C3uGZVGM7oMOcEps/gZY2Zhhqd/DoyvZJ s6c1tiQWYNTIj5JFmAUEg3kM1Gt7WkPhAqtVtvjVvyZJNQU7fM6zAixHnhYtLqUyoxcv4HJWS l20OpT3/OiJEepE0Zv5vRmJ+G48YWNoxc/8VkSqZCFFu6Ndx2X6rQLcyUIeDjdkwr6P9NDcXu 0rVwnfVceb6M4rf0IiBruPUe4rhoyrq8QZja9QUzRbSpLyTVXb9x6BnF1Mpq32KF9eflgs20P Nv9vCc3vmvuqXHcq4MnNx5h3gORAAA+vfNZI5BM0vK+qR7jajhGc92ONFasYswahZ+Bt7jUzT wPHAfQStt6mek+qiSDGtlXtmByOlRsTP7/a07aaaNiGp0W3XXzM3w1UoLaV4lNJrE6O1Um9zx hJEs6cclD5D653vrsjCLHKYGUb2NgMMKLpRCYPltRj3OoGNH4w6VPrlMNbTmQ6rCQxUpBlU0c 76dZWRV42PYz85hj+HO740aHQBt4WscIPmXyr8DKP08ZNuWsATyo3vMjyL4QzSNUZmsPHIBBd MSMZlrF0kcudKDKGpoPDit5D8JA8niV2asWhDYJYSndCB+z5hH1vgCX4aBJruEaKNo74v35FF nYHF74YeFzDORpXF7RvyyfSt3gZ/mD18cz5GmKLZ2raM4USL9uDjjc1UlNaBamGmArU/7usuN DSSq36+6+sF+mDfCZtG+WOnnrIXO63z3M/lsxwSk8cyyzcIAHFvV5qnrySF1Cz6XpSxuy7YIc JUA7GVYrBlSzgov2GTAw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Multiple tty devices are have tty devices that handle the PPPIOCGUNIT and PPPIOCGCHAN ioctls. To avoid adding a compat_ioctl handler to each of those, add it directly in tty_compat_ioctl so we can remove the calls from fs/compat_ioctl.c. Reviewed-by: Greg Kroah-Hartman Cc: Paul Mackerras Signed-off-by: Arnd Bergmann --- drivers/tty/tty_io.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.20.0 diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index c09691b20a25..a81807b394d1 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -87,6 +87,7 @@ #include #include #include +#include #include #include #include @@ -2811,6 +2812,9 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd, #endif case TIOCGSOFTCAR: case TIOCSSOFTCAR: + + case PPPIOCGCHAN: + case PPPIOCGUNIT: return tty_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); case TIOCCONS: case TIOCEXCL: From patchwork Wed Oct 9 19:10:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175647 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171609ill; Wed, 9 Oct 2019 12:12:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyb+hTF3hlaLQC1TlU46zABinO0o6Ssc2HuT7vjVoAQW9XN7vRUxBREFmcaUfdhJZlvMXHb X-Received: by 2002:a05:6402:2042:: with SMTP id bc2mr4552750edb.12.1570648327718; Wed, 09 Oct 2019 12:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648327; cv=none; d=google.com; s=arc-20160816; b=qrvDIecmbhDS+xDwb3YYDYFXouNbs0Dpg5ziH46AoDeqdZ1BPLtnOcq9nJl21bujM2 wr6HIhQrErmgDEeH+HAPClgpjF/+nAtrjCgHgoaNjlLVvol/pdjS8Z4T5T5QJzJ5IES3 n+luYZepJy+ojRQ1JO80mk0TbE8wHISZb7Eb+zmFX8QEfElWWOa4n6GYA0QBt8RAdnl4 8KRSt7aZNjfvgcI3VrFLzNi3+V7qx2Nw4xkG+MWDVLpnRe0UtlSJd1Tmny7Dohf0XxzE 2GuUAFLS4JJTozMViJNDTAJZbjC2DQBHGHOyy5D5KRfhqbNxOZCOmxbBQQxlCHo8QzsP 6k+w== 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=2U0R9XLW5nfShfx5anlsuf7ibZ8182mJ82UEsDkmLyw=; b=oS0pfnQQ14dR6QTBUxKdAJMWK3tRE9hqjyzxnnnnSGT9oDmVUdPOeGtMLkRpxd8v05 AFIv9GuZekVSUGaE8gYx/1Bl9jyCiefsbBAU7uAwo6t/4rMfBcqTZfrOV4yz4XCrv1Qc sD5/BGSJhjKpexBf6dQSLXZYe13sZXh7MEuhrC+8mGv0FE3+Ux/0nGONVSo+W0Y6nBoP u08uNx4lIwVVSfXOdW2MvYeJRtihLI8hQA30tPEXeMPpFvNu1ror3nv9L3eHJyqe3V3/ XyGPl7HOowvSlHNLKaQyD2gtTHS0WdDKUY3i/B3BefrOOHIS4bmYOoE47aa5VeHMAuij VooA== 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 gh16si1676469ejb.150.2019.10.09.12.12.07; Wed, 09 Oct 2019 12:12:07 -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 S1732127AbfJITLi (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:38 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:49579 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732007AbfJITL2 (ORCPT ); Wed, 9 Oct 2019 15:11:28 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1Md6dH-1hiwkU0jNz-00aG5k; Wed, 09 Oct 2019 21:11:21 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, linux-ppp@vger.kernel.org, Paul Mackerras , "David S. Miller" , Arnd Bergmann Subject: [PATCH v6 38/43] compat_ioctl: move PPPIOCSCOMPRESS to ppp_generic Date: Wed, 9 Oct 2019 21:10:39 +0200 Message-Id: <20191009191044.308087-39-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:H6G0tlLSScXup0r7qf/eAazbyiLfB1lHraA+to9mpDntYcl55Fx rV4LMRRmalhAIrE4CLMuoXlSi43enKLVS1soV9cB/axH1hNh69KlrEr/90ZIJYNvBDzt2uS q0SPqlKKurnJ6Sk2G7iPnPbbR4ATD9bd6k8dT3+mAmEXTzF3vD26SOywuwEy/YN2vTshp/Y TGyvbKmU/56xSps1PpChw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Rq7Oei81/w8=:kSykHrXN0CmDk/mp6241EF XQ1OAhGsHI24UVLWlFYg0SHky3n3vXHDC3MDmXbIqAeLz9ylkQluT7c5tc65FHuzhUI9/er9X najDOE+hbSvosgtUGUFa29rwC1XrP7U9wyUOVc9SiKXvF8uTWxKIyYo+/WyFgaT3XAbXyo68B wgJLYglr5IE7AsDf4QYmZk8HScOQxMYFfjXGKdHrgSwq1bFmeejio0GehhdJPtR7vFg2xLHuX d3Ul6z8+UZvLa0vp+I+BCzfLYGUn4DEdIaIoEVZsAiUCjdocQ5oPya6zxG7uob9MPYKr4PuBL RpAK2To3rtV+9YGDy5VoXpQR1ixjeOhRwuhspKmT0jZZTmLjbYW0rmHff07wtWVKU8+qkynwt IlickwH2a2DmRFLB/GUgS1RHQfu7yKvO9sEm+PLmRqqZe1F4Ja9rCPnYI1gBDapRnGAUtLENk jVoyjSvwSP6eKRfzQX16AaCYf8/EUaltABOz5IPYafpaOYsgz/FVEdvToPNW0SwOiOFw1yzXJ UtBqWrFsIclFWLyxSSVId8qKFhMjmQx1rzv0piOt6KDRop+SsrAwM0gfjDhNCod5GaSVmPLKG 0hcD0Ro1hdhVNbNsXuWjg8lnIKwbyWhFG50+fGH2aGRoR1htTZ8uX96JwaXflNUvOfoTbEMjm 78o5r8Q4D++z+0b64V2GXof51PUasLrvEjUseUytCXIA4cXtYjynYMYAQJOGqdmHvzcMH63eD QJ/ETelUxdp9k2heA5yoahl3/BUc0aKoswgoCRrmozGkpgiK4jVEbf6rgm+f4fs/KCRMJtOQS +bOBjVaBMdSD+QOJpWg9kjfXUqj0JGgcj0uSx6AHeVjPAmPvUtsE7iNXe1p9yGENuVeKEUCiM Be2qhJvzUMBBG1rD+ARA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Rather than using a compat_alloc_user_space() buffer, moving this next to the native handler allows sharing most of the code, leaving only the user copy portion distinct. Signed-off-by: Al Viro Cc: netdev@vger.kernel.org Cc: linux-ppp@vger.kernel.org Cc: Paul Mackerras Cc: "David S. Miller" Signed-off-by: Arnd Bergmann --- drivers/net/ppp/ppp_generic.c | 53 +++++++++++++++++++++++++---------- fs/compat_ioctl.c | 32 --------------------- 2 files changed, 38 insertions(+), 47 deletions(-) -- 2.20.0 diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 7f8430e6b137..fb8e0ac099b8 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -270,7 +270,7 @@ static void ppp_mp_insert(struct ppp *ppp, struct sk_buff *skb); static struct sk_buff *ppp_mp_reconstruct(struct ppp *ppp); static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb); #endif /* CONFIG_PPP_MULTILINK */ -static int ppp_set_compress(struct ppp *ppp, unsigned long arg); +static int ppp_set_compress(struct ppp *ppp, struct ppp_option_data *data); static void ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound); static void ppp_ccp_closed(struct ppp *ppp); static struct compressor *find_compressor(int type); @@ -708,9 +708,14 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) break; case PPPIOCSCOMPRESS: - err = ppp_set_compress(ppp, arg); + { + struct ppp_option_data data; + if (copy_from_user(&data, argp, sizeof(data))) + err = -EFAULT; + else + err = ppp_set_compress(ppp, &data); break; - + } case PPPIOCGUNIT: if (put_user(ppp->file.index, p)) break; @@ -827,6 +832,13 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } #ifdef CONFIG_COMPAT +struct ppp_option_data32 { + compat_uptr_t ptr; + u32 length; + compat_int_t transmit; +}; +#define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32) + static long ppp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct ppp_file *pf; @@ -863,6 +875,21 @@ static long ppp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long break; } #endif /* CONFIG_PPP_FILTER */ + case PPPIOCSCOMPRESS32: + { + struct ppp_option_data32 data32; + if (copy_from_user(&data32, argp, sizeof(data32))) { + err = -EFAULT; + } else { + struct ppp_option_data data = { + .ptr = compat_ptr(data32.ptr), + .length = data32.length, + .transmit = data32.transmit + }; + err = ppp_set_compress(ppp, &data); + } + break; + } } } mutex_unlock(&ppp_mutex); @@ -2783,24 +2810,20 @@ ppp_output_wakeup(struct ppp_channel *chan) /* Process the PPPIOCSCOMPRESS ioctl. */ static int -ppp_set_compress(struct ppp *ppp, unsigned long arg) +ppp_set_compress(struct ppp *ppp, struct ppp_option_data *data) { - int err; + int err = -EFAULT; struct compressor *cp, *ocomp; - struct ppp_option_data data; void *state, *ostate; unsigned char ccp_option[CCP_MAX_OPTION_LENGTH]; - err = -EFAULT; - if (copy_from_user(&data, (void __user *) arg, sizeof(data))) - goto out; - if (data.length > CCP_MAX_OPTION_LENGTH) + if (data->length > CCP_MAX_OPTION_LENGTH) goto out; - if (copy_from_user(ccp_option, (void __user *) data.ptr, data.length)) + if (copy_from_user(ccp_option, data->ptr, data->length)) goto out; err = -EINVAL; - if (data.length < 2 || ccp_option[1] < 2 || ccp_option[1] > data.length) + if (data->length < 2 || ccp_option[1] < 2 || ccp_option[1] > data->length) goto out; cp = try_then_request_module( @@ -2810,8 +2833,8 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) goto out; err = -ENOBUFS; - if (data.transmit) { - state = cp->comp_alloc(ccp_option, data.length); + if (data->transmit) { + state = cp->comp_alloc(ccp_option, data->length); if (state) { ppp_xmit_lock(ppp); ppp->xstate &= ~SC_COMP_RUN; @@ -2829,7 +2852,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) module_put(cp->owner); } else { - state = cp->decomp_alloc(ccp_option, data.length); + state = cp->decomp_alloc(ccp_option, data->length); if (state) { ppp_recv_lock(ppp); ppp->rstate &= ~SC_DECOMP_RUN; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index eda41b2537f0..0b5a732d7afd 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -99,13 +99,6 @@ static int sg_grt_trans(struct file *file, } #endif /* CONFIG_BLOCK */ -struct ppp_option_data32 { - compat_caddr_t ptr; - u32 length; - compat_int_t transmit; -}; -#define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32) - struct ppp_idle32 { compat_time_t xmit_idle; compat_time_t recv_idle; @@ -133,29 +126,6 @@ static int ppp_gidle(struct file *file, unsigned int cmd, return err; } -static int ppp_scompress(struct file *file, unsigned int cmd, - struct ppp_option_data32 __user *odata32) -{ - struct ppp_option_data __user *odata; - __u32 data; - void __user *datap; - - odata = compat_alloc_user_space(sizeof(*odata)); - - if (get_user(data, &odata32->ptr)) - return -EFAULT; - - datap = compat_ptr(data); - if (put_user(datap, &odata->ptr)) - return -EFAULT; - - if (copy_in_user(&odata->length, &odata32->length, - sizeof(__u32) + sizeof(int))) - return -EFAULT; - - return do_ioctl(file, PPPIOCSCOMPRESS, (unsigned long) odata); -} - /* * simple reversible transform to make our table more evenly * distributed after sorting. @@ -249,8 +219,6 @@ static long do_ioctl_trans(unsigned int cmd, switch (cmd) { case PPPIOCGIDLE32: return ppp_gidle(file, cmd, argp); - case PPPIOCSCOMPRESS32: - return ppp_scompress(file, cmd, argp); #ifdef CONFIG_BLOCK case SG_GET_REQUEST_TABLE: return sg_grt_trans(file, cmd, argp); From patchwork Wed Oct 9 19:10:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175657 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1173004ill; Wed, 9 Oct 2019 12:13:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMPuysOcjnHbYYHe89Y+ah15adn5MjQTfNuXg5v01xPNEgZa5x6704ZK/s8mySxCPvc2YC X-Received: by 2002:a50:eb4d:: with SMTP id z13mr4369641edp.175.1570648395411; Wed, 09 Oct 2019 12:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648395; cv=none; d=google.com; s=arc-20160816; b=SN45OrZ2OozLzlaCt9q39Xn4rdWdwXZGBYt0BQZYqRIoTIwZd9zz70JKIz8PrnpQvx NMjHqY73ljPKQ6lz9MZzmOCh8OZgL+efSm7vMy5P2/feED5un9/pAibxHYJjnXRfjRCK xfpA5WohTGVxeC2SNOCZ6aHQUHWMhqJRrngI3TaJrO8wRq8QKq2+lcgbS/kS9V8mjPP0 ZBd0yid15LWFbecxvMBKtlt0snoJI/rNcicQ5CsIuR9CXFkxjH3mepWtqsDOPvCEyRMj t+DgJLWq/7JYfKi3gDI9CllcUJbRnCo8mG/IDx0wqQPXNufabgVErwJxycr6XjYJDEkE K6Lg== 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=31njeplchf3n2CgNbivuRpAgvYvny6CupOcPf8qsIhI=; b=z9eGfHMGZ3MURuNsOKIX1XgHpy/ZYHvfcdl/Zc1QtxfDGFWC98TfLM78J20Y6rrSwp LOXOT7wXahHZGnpRKkBkBI3sLfN0RaYhPvtpDa3nXFtnyUU26UfYZP3EayQi9/tiV8T1 5m5VOYsN/KFlSEUy0fNLgP5ZajJEspooIpegd2YlS3DFuBH8zUDmyVG6MAVL3dDLiIor AI60uLCtMhrdgupWhNNtNaafUE+R9Ut8MetGjayblONUXQTI8JzGSR9/rFYdekwpQvgI dNawOwyAJz/9K8e96ojn4UQ8f7vdeSk9jUJbv/zyrWRwln2uKQdMzf9sNNVrlBpDdsdZ RHZA== 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 b34si2181312edb.439.2019.10.09.12.13.15; Wed, 09 Oct 2019 12:13:15 -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 S1732425AbfJITNN (ORCPT + 26 others); Wed, 9 Oct 2019 15:13:13 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:53503 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732002AbfJITL1 (ORCPT ); Wed, 9 Oct 2019 15:11:27 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MUY9w-1iiiBV1xEO-00QSut; Wed, 09 Oct 2019 21:11:21 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , netdev@vger.kernel.org, linux-ppp@vger.kernel.org, Paul Mackerras , "David S. Miller" Subject: [PATCH v6 39/43] compat_ioctl: handle PPPIOCGIDLE for 64-bit time_t Date: Wed, 9 Oct 2019 21:10:40 +0200 Message-Id: <20191009191044.308087-40-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:XaZibNUey55BMqfiAmH+lAmo19jt19/j7KilyEkR7gxnx2Y33W1 3a5i6NeROriH8Ok/LB7NTaZnJr2J6Fw/pDFTDJQgaTARt9mozuC8avkT3BTC0HjGS6VumMz /MZ9ojpq5p9359CpshBcqrt2dQ4ChFiN3xlTgRtfyywfDkMtEK0S+kNjRTR7Lfu2noEo/3w AfV/La8tp1l7nZHwLIQ0w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:PL42KE+IjLg=:7s4r0dXaWqnQWko3XOcQ8R /OoUrwpyOh3OsfZaQLcm+Tx+VSxfm1wA7JBEIkhJXeCV/cJkFO/+UPTxdQwLKXBc61W9/wgYZ 4ueTSnMkju6bPLamC+I4lkobwbLovbizFAYXydBAIDJVVIgC1V905MdRK8/8BsJgqjm88SX8R rF5Rs9+GtM7Aah+Zl7cFILVLLNiP2AyCiZe79QP1ypJAde3sZnjNHrTzxU9T76IHBWhQcsfWH NkJkBQ6elM4Kb2YMnYFrzDoxq0OYjSVExtDVhjNEvoFFn8n8dSsr8GWPauYZ7o5kZU+PI6SYW kjyBB8+i7HQupnB1C5PPKHAZvygFP7MSD35MdeUvOSo1JdKwepvL12w4D8tWSnE+0uaMGrCj4 UZAiZVSsZslOzJdXGj2zV5fxn378NAzFbNCYnzbLJ5Jtc5QrQTN80vPzwov/XE9+TF2Kn+WZJ dJvFxy3LLX+JqlrwR/yKmK0C8eP4C4DfNhIqVHb2KZbMLGY/B6f1IY9XGHiGSYPfuJKeLEVBs 1tU31oFQKMHvaRPDE26qtrmJ9Lj6XEyw2kUWpYc1gPcE+4EIPKLU8NvNSrV676yjHkRqfmB+c 3WpztlrkpQ88d2MUCFopazCJws0eki+cFhtrEDlKn7D6sohzdNqxCkJAbHS7Mz/XpnLIbAOJq B1vZQinoPiiXDP9TfpUSstKsbwB62dS9yCMLbg5yi6tUcCp2UECmIg0yd1TzLT+BPEn8Bf6FG U9UkBNftW6U7xD7cTWhTlZCMVlBk3gWg3YBD9iYBf4WhkgRnrohTrPAE26yKMQwv42y5tR8lZ F0kbR7OxuuR/LQwfKs19CmNyRlhXVE9zfCRnX1UJcNx7DysCZ82x1tBrhwAA96LddEQrnHTXr AEfSBrd0VmAUk4FqRSEQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ppp_idle structure is defined in terms of __kernel_time_t, which is defined as 'long' on all architectures, and this usage is not affected by the y2038 problem since it transports a time interval rather than an absolute time. However, the ppp user space defines the same structure as time_t, which may be 64-bit wide on new libc versions even on 32-bit architectures. It's easy enough to just handle both possible structure layouts on all architectures, to deal with the possibility that a user space ppp implementation comes with its own ppp_idle structure definition, as well as to document the fact that the driver is y2038-safe. Doing this also avoids the need for a special compat mode translation, since 32-bit and 64-bit kernels now support the same interfaces. The old 32-bit structure is also available on native 64-bit architectures now, but this is harmless. Cc: netdev@vger.kernel.org Cc: linux-ppp@vger.kernel.org Cc: Paul Mackerras Cc: "David S. Miller" Signed-off-by: Arnd Bergmann --- Documentation/networking/ppp_generic.txt | 2 ++ drivers/net/ppp/ppp_generic.c | 19 ++++++++---- fs/compat_ioctl.c | 38 ++++-------------------- include/uapi/linux/ppp-ioctl.h | 2 ++ include/uapi/linux/ppp_defs.h | 14 +++++++++ 5 files changed, 37 insertions(+), 38 deletions(-) -- 2.20.0 diff --git a/Documentation/networking/ppp_generic.txt b/Documentation/networking/ppp_generic.txt index 61daf4b39600..fd563aff5fc9 100644 --- a/Documentation/networking/ppp_generic.txt +++ b/Documentation/networking/ppp_generic.txt @@ -378,6 +378,8 @@ an interface unit are: CONFIG_PPP_FILTER option is enabled, the set of packets which reset the transmit and receive idle timers is restricted to those which pass the `active' packet filter. + Two versions of this command exist, to deal with user space + expecting times as either 32-bit or 64-bit time_t seconds. * PPPIOCSMAXCID sets the maximum connection-ID parameter (and thus the number of connection slots) for the TCP header compressor and diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index fb8e0ac099b8..ce4dd45c541d 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -612,7 +612,8 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct ppp_file *pf; struct ppp *ppp; int err = -EFAULT, val, val2, i; - struct ppp_idle idle; + struct ppp_idle32 idle32; + struct ppp_idle64 idle64; struct npioctl npi; int unit, cflags; struct slcompress *vj; @@ -735,10 +736,18 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) err = 0; break; - case PPPIOCGIDLE: - idle.xmit_idle = (jiffies - ppp->last_xmit) / HZ; - idle.recv_idle = (jiffies - ppp->last_recv) / HZ; - if (copy_to_user(argp, &idle, sizeof(idle))) + case PPPIOCGIDLE32: + idle32.xmit_idle = (jiffies - ppp->last_xmit) / HZ; + idle32.recv_idle = (jiffies - ppp->last_recv) / HZ; + if (copy_to_user(argp, &idle32, sizeof(idle32))) + break; + err = 0; + break; + + case PPPIOCGIDLE64: + idle64.xmit_idle = (jiffies - ppp->last_xmit) / HZ; + idle64.recv_idle = (jiffies - ppp->last_recv) / HZ; + if (copy_to_user(argp, &idle64, sizeof(idle64))) break; err = 0; break; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 0b5a732d7afd..5e59101ef981 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -52,6 +52,7 @@ #include +#ifdef CONFIG_BLOCK static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int err; @@ -63,7 +64,6 @@ static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return vfs_ioctl(file, cmd, arg); } -#ifdef CONFIG_BLOCK struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */ char req_state; char orphan; @@ -99,33 +99,6 @@ static int sg_grt_trans(struct file *file, } #endif /* CONFIG_BLOCK */ -struct ppp_idle32 { - compat_time_t xmit_idle; - compat_time_t recv_idle; -}; -#define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32) - -static int ppp_gidle(struct file *file, unsigned int cmd, - struct ppp_idle32 __user *idle32) -{ - struct ppp_idle __user *idle; - __kernel_time_t xmit, recv; - int err; - - idle = compat_alloc_user_space(sizeof(*idle)); - - err = do_ioctl(file, PPPIOCGIDLE, (unsigned long) idle); - - if (!err) { - if (get_user(xmit, &idle->xmit_idle) || - get_user(recv, &idle->recv_idle) || - put_user(xmit, &idle32->xmit_idle) || - put_user(recv, &idle32->recv_idle)) - err = -EFAULT; - } - return err; -} - /* * simple reversible transform to make our table more evenly * distributed after sorting. @@ -192,7 +165,8 @@ COMPATIBLE_IOCTL(PPPIOCGDEBUG) COMPATIBLE_IOCTL(PPPIOCSDEBUG) /* PPPIOCSPASS is translated */ /* PPPIOCSACTIVE is translated */ -/* PPPIOCGIDLE is translated */ +COMPATIBLE_IOCTL(PPPIOCGIDLE32) +COMPATIBLE_IOCTL(PPPIOCGIDLE64) COMPATIBLE_IOCTL(PPPIOCNEWUNIT) COMPATIBLE_IOCTL(PPPIOCATTACH) COMPATIBLE_IOCTL(PPPIOCDETACH) @@ -214,16 +188,14 @@ COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) static long do_ioctl_trans(unsigned int cmd, unsigned long arg, struct file *file) { +#ifdef CONFIG_BLOCK void __user *argp = compat_ptr(arg); switch (cmd) { - case PPPIOCGIDLE32: - return ppp_gidle(file, cmd, argp); -#ifdef CONFIG_BLOCK case SG_GET_REQUEST_TABLE: return sg_grt_trans(file, cmd, argp); -#endif } +#endif return -ENOIOCTLCMD; } diff --git a/include/uapi/linux/ppp-ioctl.h b/include/uapi/linux/ppp-ioctl.h index 88b5f9990320..7bd2a5a75348 100644 --- a/include/uapi/linux/ppp-ioctl.h +++ b/include/uapi/linux/ppp-ioctl.h @@ -104,6 +104,8 @@ struct pppol2tp_ioc_stats { #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ +#define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32) /* 32-bit times */ +#define PPPIOCGIDLE64 _IOR('t', 63, struct ppp_idle64) /* 64-bit times */ #define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ #define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ #define PPPIOCDETACH _IOW('t', 60, int) /* obsolete, do not use */ diff --git a/include/uapi/linux/ppp_defs.h b/include/uapi/linux/ppp_defs.h index fff51b91b409..0039fa39a358 100644 --- a/include/uapi/linux/ppp_defs.h +++ b/include/uapi/linux/ppp_defs.h @@ -142,10 +142,24 @@ struct ppp_comp_stats { /* * The following structure records the time in seconds since * the last NP packet was sent or received. + * + * Linux implements both 32-bit and 64-bit time_t versions + * for compatibility with user space that defines ppp_idle + * based on the libc time_t. */ struct ppp_idle { __kernel_time_t xmit_idle; /* time since last NP packet sent */ __kernel_time_t recv_idle; /* time since last NP packet received */ }; +struct ppp_idle32 { + __s32 xmit_idle; /* time since last NP packet sent */ + __s32 recv_idle; /* time since last NP packet received */ +}; + +struct ppp_idle64 { + __s64 xmit_idle; /* time since last NP packet sent */ + __s64 recv_idle; /* time since last NP packet received */ +}; + #endif /* _UAPI_PPP_DEFS_H_ */ From patchwork Wed Oct 9 19:10:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175643 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171128ill; Wed, 9 Oct 2019 12:11:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXCcSk/JATI7WI56niZkQAO/7Lie621bB6qbTR/veSKxB7s+M0pMFkPcTXZpUXCE2oLITJ X-Received: by 2002:a50:e606:: with SMTP id y6mr4408527edm.261.1570648305082; Wed, 09 Oct 2019 12:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648305; cv=none; d=google.com; s=arc-20160816; b=W4lGZtlAFqElD2r2nXY/HTzLToE6yXKZlPI5wpQRAazsx9+v/Lp/68EQw5xmRyYLZH pPOBrV5EFcmnv9lQYFBHUANB6ej8Gt8+sE8SyIyfj3Zi5cdlCKWHRkeInnnuoa+OCOGh 6iIfR1CdkCndxUNpC60pZfL9RYhTjW2CKECUmX6nZ4kwj/zEvIlyWp20HNlky5NTzjpY PBVHozYnpq2lgBcuzWiMVGkBGN8cfPyqfFApedlnZoAOo5GFhTIB5FegfWKzDI0iscBB 0MgQYP1dckZUf/ic6Vokd9ypqX1iNS4VStIzD/gw2abwIGltz70XGLFc96Lw7ygglafK v1IQ== 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=CsKyN8oSfUo6ZWX1JLz6AbGz0bERVLn/lBHWctgqrvg=; b=es5cGJSQ7AQuluMJnI6vqp6B2YPPVAohQvWxgs3bzKlO284VHRBypYxkuz4drGQjd9 IdjxUQ+NSksRNm/8ZatR97ZiEUXL6N3hqSCtjnhqFrUo1/R+ciaF+rcBCZ7gladlIy5d yyEK8GXpN/t6fLBHGnWpBBZhTJ1HoGhkZj+RIQqLtHlEe0H+u+dEqClXGlLV6HAnI8IR q+KGB9m5ZmI05nbxi4U8S0vA5teWwG+vgH4WGbAZReXAGUCgcEOmj7hKtOIv9Hn9OgYO rNSMKrHpNt3V9Dj4FUrqkwxyfAcXv673l4b+iInZ63xEGph7792PRAuxmK44B9q46koQ dN9g== 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 va7si1709036ejb.4.2019.10.09.12.11.44; Wed, 09 Oct 2019 12:11:45 -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 S1732151AbfJITLk (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:40 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:45423 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732066AbfJITLd (ORCPT ); Wed, 9 Oct 2019 15:11:33 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MXotA-1ib0Xm0A5U-00Y8QV; Wed, 09 Oct 2019 21:11:22 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , linux-scsi@vger.kernel.org, Doug Gilbert , "James E.J. Bottomley" , "Martin K. Petersen" Subject: [PATCH v6 41/43] compat_ioctl: move SG_GET_REQUEST_TABLE handling Date: Wed, 9 Oct 2019 21:10:42 +0200 Message-Id: <20191009191044.308087-42-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:p7Tc//BuR7qdz2xwgrqekZl/T08X8CkoWdOtYvxnp+Bnzgn9Uj7 sAo1jJmlSHjzs5xbyAt88mQJgrMQQkQlwzqT+rSKafIvWdfeMntJkYSBMs+BkJy82ISeh0H cIsrVtG2023QK4n/BOJ/SXqjlr6TRtcLNDDt5CVctNJTL0LmzQ9SRSfu7eEaTflg8MfvlnX T4k+u6NPrU4atJQvOg9Mw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:d4mN/yyRcj8=:TTGVKCdrOl6cbcoLsASAxH kEVn9N9blBIh/ydPtDoiNrGXUt0w+lsODlOQ4ZbQ10H7P0nGg5FB8Ix2gqOzHwQPg5XjYvA0M OxUWCMQuGZ6e2hiDbTK7u6VvVLryKAbvKE5d7HfNePfwIi8nwwKUCwZ5VZBU8H8J8kRfqLb5B q6Lbp46cimVpv3E83rzt/wq0YxKERx4nGqHZ1YpBztjPBuAGLuh11mdTZTnnKeeHi09MrubPl 9BL7+y6WbEyCuWOHIxmPrHHGkpe4pvuIL26//2Nbi7D3u511PEMowfGuDFBF0xqAvd1zHAL4i unBTi8+fTlnq3kzqbdrn2V5N2uhMinIrDNqv6hmm5kpxLozsE9OJu91n5xzye5CSUNNIScPeX Hw++dibuo02BNKb493CplF4yRZlxIGW7cpMJxg2OF+bxEq0NVQ21cgJ4yGzwIj08KZPJ8wUGn VG70GU21vGUva1yJrY8e1cz8PQLg009xUSWHOPqI64FN6UBDzmvxZzImnnDEfVnXvFGX4ra+D eEnrakXeTjJbmSQ1javGLTQICDgHjcFEjfO3cOAKfWNzdxmfEQSXfhvz1OaiOvQ2lbClhvRmG DWB/VWNLLLv7qrljQFMCAZzIQSS2Pq+4qPOHSVOV/dnLtEf4QFpH8wGkUynZy+8LxgyYPHZas opv6lbCaVeqYW7YYNkEf80JuxWQMyxLCoRcy13mlz00Uu3AASfuSMJ/xLwo7yIUnofnmDdZHO eeVfsGhwQu4mMURh1fQxLhwxr4YApqOLakENRSJXlo++sCJmCqokyXVMJy8PquYBhWcG5TP5L +mHLDB6hbb8JrMiieemRSJKIszB2z6RZcNLbSnNDoMKohPz5vcXywWsR3BtSOKUiWWhv6LLRI eslWOrwcydSqNlIZ4EkA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SG_GET_REQUEST_TABLE is now the last ioctl command that needs a conversion handler. This is only used in a single file, so the implementation should be there. I'm trying to simplify it in the process, to get rid of the compat_alloc_user_space() and extra copy, by adding a put_compat_request_table() function instead, which copies the data in the right format to user space. Cc: linux-scsi@vger.kernel.org Cc: Doug Gilbert Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Signed-off-by: Arnd Bergmann --- drivers/scsi/sg.c | 40 ++++++++++++++++++++++++++++----- fs/compat_ioctl.c | 57 +---------------------------------------------- 2 files changed, 36 insertions(+), 61 deletions(-) -- 2.20.0 diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 8ae096af2667..9e4ef22b3579 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -889,6 +889,33 @@ sg_fill_request_table(Sg_fd *sfp, sg_req_info_t *rinfo) } } +#ifdef CONFIG_COMPAT +struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */ + char req_state; + char orphan; + char sg_io_owned; + char problem; + int pack_id; + compat_uptr_t usr_ptr; + unsigned int duration; + int unused; +}; + +static int put_compat_request_table(struct compat_sg_req_info __user *o, + struct sg_req_info *rinfo) +{ + int i; + for (i = 0; i < SG_MAX_QUEUE; i++) { + if (copy_to_user(o + i, rinfo + i, offsetof(sg_req_info_t, usr_ptr)) || + put_user((uintptr_t)rinfo[i].usr_ptr, &o[i].usr_ptr) || + put_user(rinfo[i].duration, &o[i].duration) || + put_user(rinfo[i].unused, &o[i].unused)) + return -EFAULT; + } + return 0; +} +#endif + static long sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) { @@ -1069,9 +1096,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) val = (sdp->device ? 1 : 0); return put_user(val, ip); case SG_GET_REQUEST_TABLE: - if (!access_ok(p, SZ_SG_REQ_INFO * SG_MAX_QUEUE)) - return -EFAULT; - else { + { sg_req_info_t *rinfo; rinfo = kcalloc(SG_MAX_QUEUE, SZ_SG_REQ_INFO, @@ -1081,8 +1106,13 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) read_lock_irqsave(&sfp->rq_list_lock, iflags); sg_fill_request_table(sfp, rinfo); read_unlock_irqrestore(&sfp->rq_list_lock, iflags); - result = __copy_to_user(p, rinfo, - SZ_SG_REQ_INFO * SG_MAX_QUEUE); + #ifdef CONFIG_COMPAT + if (in_compat_syscall()) + result = put_compat_request_table(p, rinfo); + else + #endif + result = copy_to_user(p, rinfo, + SZ_SG_REQ_INFO * SG_MAX_QUEUE); result = result ? -EFAULT : 0; kfree(rinfo); return result; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 3cf8b6d113c3..9ae90d728c0f 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -52,53 +52,6 @@ #include -#ifdef CONFIG_BLOCK -static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - int err; - - err = security_file_ioctl(file, cmd, arg); - if (err) - return err; - - return vfs_ioctl(file, cmd, arg); -} - -struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */ - char req_state; - char orphan; - char sg_io_owned; - char problem; - int pack_id; - compat_uptr_t usr_ptr; - unsigned int duration; - int unused; -}; - -static int sg_grt_trans(struct file *file, - unsigned int cmd, struct compat_sg_req_info __user *o) -{ - int err, i; - sg_req_info_t __user *r; - r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); - err = do_ioctl(file, cmd, (unsigned long)r); - if (err < 0) - return err; - for (i = 0; i < SG_MAX_QUEUE; i++) { - void __user *ptr; - int d; - - if (copy_in_user(o + i, r + i, offsetof(sg_req_info_t, usr_ptr)) || - get_user(ptr, &r[i].usr_ptr) || - get_user(d, &r[i].duration) || - put_user((u32)(unsigned long)(ptr), &o[i].usr_ptr) || - put_user(d, &o[i].duration)) - return -EFAULT; - } - return err; -} -#endif /* CONFIG_BLOCK */ - /* * simple reversible transform to make our table more evenly * distributed after sorting. @@ -121,6 +74,7 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) #ifdef CONFIG_BLOCK /* SG stuff */ COMPATIBLE_IOCTL(SG_IO) +COMPATIBLE_IOCTL(SG_GET_REQUEST_TABLE) COMPATIBLE_IOCTL(SG_SET_TIMEOUT) COMPATIBLE_IOCTL(SG_GET_TIMEOUT) COMPATIBLE_IOCTL(SG_EMULATED_HOST) @@ -156,15 +110,6 @@ COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN) static long do_ioctl_trans(unsigned int cmd, unsigned long arg, struct file *file) { -#ifdef CONFIG_BLOCK - void __user *argp = compat_ptr(arg); - - switch (cmd) { - case SG_GET_REQUEST_TABLE: - return sg_grt_trans(file, cmd, argp); - } -#endif - return -ENOIOCTLCMD; } From patchwork Wed Oct 9 19:10:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175642 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1170897ill; Wed, 9 Oct 2019 12:11:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyn+7zUaQq2nWG2n8+5Su+YxQAhLY6HvP19j4XoZ9/PkY0qhhOiuK6SGzLSe/sM4L7WEAol X-Received: by 2002:a50:f10a:: with SMTP id w10mr4455971edl.247.1570648295277; Wed, 09 Oct 2019 12:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648295; cv=none; d=google.com; s=arc-20160816; b=f0ZJcQwTovVoJTdCsvO84kVmE7OlNT4QwfOcebkcjg8ZkRxgbOfqeLCfl1p1/RvTYL R4VExkMCkKUliMZAKx7H1V0Wkb2qhgHa0OLTmUgTP0TlIafkE8T/IMepMyMSJxZboh2V TzglZQhtD318Enn9s+INgPcrT20MFJP0v7AGKd5isBeQ1+tJBk7NkKozfcOl02JWbu76 js6fC2ywPiA7KMGZoY2qAkZpEniMd01xryq8wFnD26zddwqmaoQBOWdnfayLV23YilYN s7Os1okaBktK+yozj830hh6DnZXa9x7L9sd6WE1JBVg2+hMlbkoDsZt5xp9j2g3+HK2C ptIw== 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=yQO6BzXv9wwB+rTAMKrQUACHs5hkCS1PWl0LeRqMgRY=; b=ZfmTF+x2gcJGm2ZncpFySZA+Qw0HEHNwdSyFo/7D1281lR5uoD1DoUrRiNGMeAReXv /Do1sqLgJfGsdPJdla+avN0JI3RRr6VLsR1NK6GTIZIALHoeusG89iLFbwTwWG5+CXWE 7xBHk5MPF3wmRD5uxHlDC4tkOFgbvvI7r4VM4mLJ5llwjAUlsevt7jH47bSFNsfQkQT4 BOAmEHwlJz/Yk5fBzQp2gYn9r6MiwLhew5++jhpdU4G0pLW0qWM1Pm43vJw1m7k3+JFs /8XLzSHdtP0jBhaASbyFVQbW+YGi7y9tvX/6AcE68Gc3O0jaWU440X+ZWAQKaKzvry9r oxkQ== 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 f45si2025728eda.345.2019.10.09.12.11.35; Wed, 09 Oct 2019 12:11:35 -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 S1732101AbfJITLe (ORCPT + 26 others); Wed, 9 Oct 2019 15:11:34 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:48089 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731986AbfJITLY (ORCPT ); Wed, 9 Oct 2019 15:11:24 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N8XgH-1i5VgB1LZh-014SRC; Wed, 09 Oct 2019 21:11:22 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , Jens Axboe , linux-block@vger.kernel.org Subject: [PATCH v6 42/43] pktcdvd: add compat_ioctl handler Date: Wed, 9 Oct 2019 21:10:43 +0200 Message-Id: <20191009191044.308087-43-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:93xVR2PSRzNKK3F6eEf3KloUW20yUoSchuNU1iTvhPWVCYwsH8H z13+p8ef1mAztjV2JdOjKqOYgaMbqp2tn3Z/Vg8IrXIlrGafn4DCxbrq/pChzzAUUHcuEV9 RtB6cLBqK0HwCVek/0QpPj02Twg2C0IwFQBlScLKqgWIJIg8/tqbCevylU4jhp4uvGMzVBl 3NURu7wv2UyKvLx5eGCaQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:/Z06bO3lT6w=:6NXRRLxYm/LA0XwBWwo6Q7 p/KW3+sAt3EnBV6ubbtZExBdcmG9keJjb1cALDVt3+5J5dZnQNtMCpQZqSQrSXht8Ch+KQEUG MD2bQvKIe+STPbvBSWGqwieBm7Nb6k22/aNSgdTepdK37zcaLHlAzt6ETugYcc8i8qCuQ23vz QbqIM810G2lWNY8Ap3z60/POVSiooVUxgflLJ3iW/d3y2muXKmPowKXUdofL+6iQnTQ5dlXmg dJKsOBWOfEtAvFnUtTy5qpbgVx1UCb1x0dYR19li7QIxHQbGImIFi4sxCanHAnpvZjTgO3XRr lS+mJFtS4nU8uGOxE8cu06ALG8S0LQQeYCNXgIdS8+qw9i2WqSYUCmt0JRXwhh/ACr54BSerh hOHIW0lShwaiuv8KRezSH42mGEBA2P0tK0W8I6MPKy9a4UZjVI/q46Fcll4C3+oun5NOK8F8r 1HgADAwxOEctsr516d5iH4xzz/LDcZvyldyWsSEED9n7CZ7Hib4KnZNhkN4my+gFp3AySkUMs 9Vysmz9349cTarI7TFSsIxmLZrho7bEtMoHh0NQYpq4yWmyl1sxk0RcMpATWBX/dgXoTAmlJQ +br7DNaAzWs8uXFUdM5iiVhmD/dZQGeJF05wYsF33UeeuY9JyZRK44XrOIulA0ppKA799aIxY TrlyWvXwzLaEUVi2Gmpcr6yonfuurYg1p7+y1oi0I2K5hDIBiYRbNzbWR3PD+8Z3jnrCsT0+X DOM8GRXm297v4+bx+scA0bJ1R7XBVvz8IxrtzT3bwNAfxyXinOjCqZK68Ml/P0kfC/EZF8Bwt FvkQTEKTAA29QbZszpwY36dp9F5SUveI9RVSd/U6TyhfPb2x6mbg0h+M1etFyQdCq8Ug/HyjY r8LwN/SEfrpnWkDGz16Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pkt_ioctl() implements the generic SCSI_IOCTL_SEND_COMMAND and some cdrom ioctls by forwarding to the underlying block device. For compat_ioctl handling, this always takes a roundtrip through fs/compat_ioctl.c that we should try to avoid, at least for the compatible commands. CDROM_SEND_PACKET is an exception here, it requires special translation in compat_blkdev_driver_ioctl(). CDROM_LAST_WRITTEN has no compat handling at the moment. Cc: Jens Axboe Cc: linux-block@vger.kernel.org Signed-off-by: Arnd Bergmann --- drivers/block/pktcdvd.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) -- 2.20.0 diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 76457003f140..ee67bf929fac 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -2663,6 +2663,28 @@ static int pkt_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, return ret; } +#ifdef CONFIG_COMPAT +static int pkt_compat_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + /* compatible */ + case CDROMEJECT: + case CDROMMULTISESSION: + case CDROMREADTOCENTRY: + case SCSI_IOCTL_SEND_COMMAND: + return pkt_ioctl(bdev, mode, cmd, (unsigned long)compat_ptr(arg)); + + + /* FIXME: no handler so far */ + case CDROM_LAST_WRITTEN: + /* handled in compat_blkdev_driver_ioctl */ + case CDROM_SEND_PACKET: + default: + return -ENOIOCTLCMD; + } +} +#endif + static unsigned int pkt_check_events(struct gendisk *disk, unsigned int clearing) { @@ -2684,6 +2706,9 @@ static const struct block_device_operations pktcdvd_ops = { .open = pkt_open, .release = pkt_close, .ioctl = pkt_ioctl, +#ifdef CONFIG_COMPAT + .ioctl = pkt_compat_ioctl, +#endif .check_events = pkt_check_events, }; From patchwork Wed Oct 9 19:10:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175653 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1172554ill; Wed, 9 Oct 2019 12:12:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqymAdXecMc4B4BN/aQYPIhmWvLL+1YyTcQoIr4wJmYK5MrbP0EPl+9p/wWI7mJvrj7HqWCM X-Received: by 2002:a17:906:7212:: with SMTP id m18mr4380085ejk.88.1570648374661; Wed, 09 Oct 2019 12:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648374; cv=none; d=google.com; s=arc-20160816; b=PHCSiIt4dTzMzi3XDm1vm6mx3C0XfwiiCXLH9e6wMNHjQrZgznmt86x9jUVglv4Xvb Wvfkknj6luy9lA5+AK/szh/7gj0ao3sgpI8xHLyiuisc4BCDqbSRw+oLAenFMKH/2+JP 8qlJAWeEfUrvL5XQQ/W5sswCIVAzL4/Oh7dcsWgi0zj6AfkkZDuu9ZcYsbcZTk29R5yG Dv+3okEd337ysrXXUPFgmG4j07Up5dEg3I+va4yLNvQGfMFe8wVo3iIKW9F4hPKhaIPb TjnO02M2mPWEXVXD4LpI/EBjsZT5YkDSGBOXM3Fo3BBj2hImNK3BC3ldXm3876Z4NsIK L9lg== 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=/9A2n7GDM7hDpgWBvtRqRyhIZY6IBO7xQteYcmgJx6w=; b=LXNIKppUSo31lWIyv7B6EQwQvzZYrUwOtoMeHDAw7iCh42ZLYlSpZv0n3ylrIEUieB a2y0boQbEoQdpbqWTTFYOhlzpukeooOG1RuehHhG2yEpWMrQFRdKik+phWRmZdYHWT1P pkYmckezxz7FWeE1pVWVSd0jiO55b18NvHB5NSxE2HZG2DxkuYtm64kyGrHL/Bd1NT6P Q6NwiAT9zcrHSanfKr/hr/XWbtxSbBdTMhrPU8r2krGomoA8JCvsDfaoXDujjXNyZIGF x3fBR3l3wED6HWyjQViAE6TSAiIOL4Oe6E038lBrTSXCrmVbYg57r0fAhP62vVBOIh2Q /S9w== 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 e23si1759589edq.344.2019.10.09.12.12.54; Wed, 09 Oct 2019 12:12:54 -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 S1732356AbfJITMw (ORCPT + 26 others); Wed, 9 Oct 2019 15:12:52 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:46385 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732044AbfJITLa (ORCPT ); Wed, 9 Oct 2019 15:11:30 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MofLl-1hleRX2T5V-00p7Pi; Wed, 09 Oct 2019 21:11:22 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , linux-scsi@vger.kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" Subject: [PATCH v6 43/43] scsi: sd: enable compat ioctls for sed-opal Date: Wed, 9 Oct 2019 21:10:44 +0200 Message-Id: <20191009191044.308087-44-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:zX1dBOxTNEIjEWC6S6Aboc9GLFenI7/73H9gQTcEXZJuXQOOPKQ m3Fd1C/SOXXiF/vgpisdbgSmCcJpi/8S/vO/qXr1qfrJIStRYB3s3dEawxyMSUMn+0NTfXy Ab9xMpMNOALYbbrUsRd2FLw0Ye7wS9Iq5k27P/7uitVAlIrvvypAqXWfA5vkc0tbPYZF+1m NIF5nP/JU3XKb21XnisJw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:lFQ+r8yms6g=:sbWCiEgDC0Wd/x2FxEm0lO HIOHewpro6Y6RhDe6KbndIDg0JNlUin7WJAs+q2iO5twgzE03hJmvtw+q/+cNaD+grzoD4Oda gFzYZwLfS9Ef35ZuoxQBOuKAIMQZ7UrTAbC7A4HGnHBdrCJeuL+FAvMkx8d9Q3v8oDLoRK99G guyQ9i6W0+p2M2w3TlNGT+w7ZOCMJIl9i//enaD+YsHcY26KZ2FFZUau1fGlpuhXhAcqODDXX SIcsD74vNvgKtyEPxV9tc3Q2lfXhV6s74yPR+l6P2GlsQnPmu3EOvVNP8zyq8PBq4AP4/0PxD 8mt6NCkQTa6kLkw69qrXpOki8HjCDcvQ2jcGjludeml2Gae0+PG+4flcA4nJzyRMb5pG2bXde Gss218kuyh26mcuzvCMUzxMxLCoTBtDQiVx8PY3oe69kv15zMI+htD6Ocko1S9T0fX+4tn3KN g/dqGY4gdlj/BH/PsPlw7NfC3JvJtW5J8KgG0SAfphyamwOela5x8WVCzovCgjr4yuqFbGZXi /0zOytzYJdzQerNej9emCJzBg4g//n0fKkVR99ce+YbHmaRFLD0+QnF41NuB2SNqlkNEVDWLQ JkJ/iUs6UBYMGqIj35uk/P8skn4f3tiRIkaDlpRk4Rb8G8J9bl8MaT4JrR+dlNzyR1EswTS2M NFx1iku9lwAxHQrhCwDBbP+1xC3i60il2GQ0PiXA9ETGMcBWbWH3QQYqw3bkOQebzBgN1ezzI ucj68bPQaHNnBwPCpejCq7sFoYI8x1G2hI0OzAx8IWJrONDM4BrJghfQQvnMXkjO57YmRW3KR ppoc3ztmdrjMOaKOPqMKgvjeTkKkkZM5MPa/hI7eeaQeYRXyvd6rEK8MQdP/6fH4SgeGNu6Ru eU2kfW0Ze1W96JFfciaA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sed_ioctl() function is written to be compatible between 32-bit and 64-bit processes, however compat mode is only wired up for nvme, not for sd. Add the missing call to sed_ioctl() in sd_compat_ioctl(). Fixes: d80210f25ff0 ("sd: add support for TCG OPAL self encrypting disks") Cc: linux-scsi@vger.kernel.org Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Signed-off-by: Arnd Bergmann --- drivers/scsi/sd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 50928bc266eb..5abdf03083ae 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1692,20 +1692,30 @@ static void sd_rescan(struct device *dev) static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { - struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; + struct gendisk *disk = bdev->bd_disk; + struct scsi_disk *sdkp = scsi_disk(disk); + struct scsi_device *sdev = sdkp->device; + void __user *p = compat_ptr(arg); int error; + error = scsi_verify_blk_ioctl(bdev, cmd); + if (error < 0) + return error; + error = scsi_ioctl_block_when_processing_errors(sdev, cmd, (mode & FMODE_NDELAY) != 0); if (error) return error; + + if (is_sed_ioctl(cmd)) + return sed_ioctl(sdkp->opal_dev, cmd, p); /* * Let the static ioctl translation table take care of it. */ if (!sdev->host->hostt->compat_ioctl) return -ENOIOCTLCMD; - return sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); + return sdev->host->hostt->compat_ioctl(sdev, cmd, p); } #endif