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;