From patchwork Sat Jul 21 10:18:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10538619 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F03E16029B for ; Sat, 21 Jul 2018 10:19:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5D1528DD0 for ; Sat, 21 Jul 2018 10:19:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8A1B28E9F; Sat, 21 Jul 2018 10:19:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A006328DD0 for ; Sat, 21 Jul 2018 10:19:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727437AbeGULL3 (ORCPT ); Sat, 21 Jul 2018 07:11:29 -0400 Received: from mout.gmx.net ([212.227.15.18]:38331 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727041AbeGULL3 (ORCPT ); Sat, 21 Jul 2018 07:11:29 -0400 Received: from localhost.localdomain ([113.116.50.193]) by mail.gmx.com (mrgmx002 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LpL4H-1gCbUI05AL-00f8WK; Sat, 21 Jul 2018 12:19:11 +0200 From: Chengguang Xu To: ceph-devel@vger.kernel.org Cc: zyan@redhat.com, idryomov@gmail.com, Chengguang Xu Subject: [PATCH v2] ceph: add O_LARGEFILE flag check in ceph_open() Date: Sat, 21 Jul 2018 18:18:33 +0800 Message-Id: <20180721101833.8598-1-cgxu519@gmx.com> X-Mailer: git-send-email 2.17.1 X-Provags-ID: V03:K1:XmN9Mg1RmkzBvW9sY+c+kbZ5sFnz8rWDTNwJERDkbM7rIfS92EH kDTR3suaXGaQOY3ha9EkBKe+YymO8SvfxbVTCj7TO4ZdK80XXbM+lH49Yv2nco21m/AOcQc DoKs78AEquRDeoSe5RIjX4oQlEyqSbSEQJ0wltOPeIAHXInqCkUWyx4uAcc69UxReLiv/EG x2kGyDYnDBy5V9zxl0ckg== X-UI-Out-Filterresults: notjunk:1; V01:K0:7ontBG7tJtE=:o0jUhBzN4rO8RmEX8+URlM BvK0EFsip85aSTaA1VIKOWLohPTp0xmKcJJ4VdLtz/TYDCWWimIzTamfvIxFEXHln5vJ+p7Zb dv9TJb6PQtbm/4c2E19W53NUsBf6rFzYlQskbyvd8XQt2Cyn072oGh4I3iZaVsFBft2ykCzi/ 0dVNqkHwblF5awbjoivWCwSlBTMDRMHZesbuqnmgKH/sS/YVtTXBmKtCVS2c+w9PcRQIx2bnL ZTRlDvQhuyjH2sQ3QYB24rYmku6p/SjmcfqnUnxd5q4cPGjRsoRJcP9LuKZRhcA3cvua1jprR Uto0SZGdkSKhNiyzDzzdOlHW9oY9OmHiQWyT0gt40I3K5Gfh0iM4h3HqSAeS+rWelA3JDAkY+ egwTdfv9ln2ZVuQhorf68FFBA+ObUJtAMjtcYeq8sJi47wpsRAtArQx4aPMwytRGgJ6kBSb/p swsWUmplR4IlI7CXqD85k2zNj16S3gO7hGKLaepIqZ7G+DVSUqXW9KYwwS7cppyAQ6USRjeJj b6cGtn/epugV3lxrD7X2XryQGulqnpKBxmrbZeYytxGUaak3tnKYrhVHxrMzrW14KbYXl1C08 qoXurRpMnNe6Y6il9hPG0L69AadDISCKxQwt3IhqgWHuUjC/VcxRAoc1KLrJCfRyYxkgvFuy9 ADol9iUEh/3wY0SBqHC8gkgXZyiA/3SUa6sBfA1oLkGI+/vYCvUuaxa2x3xP7bkBd0zjAJ/Sn ZPxzlI/OxP+tnrahGcJl+eU1n10+heTlKA7An3U0v23W8zpot11o0GR0Opk= Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a check to disallow opening large files on 32bit systems if the caller didn't specify O_LARGEFILE. Signed-off-by: Chengguang Xu --- v1->v2: - Call common function generic_file_open() to check instead of adding check logic inside ceph_open(). fs/ceph/file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index ad0bed99b1d5..075bf9473abb 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -349,6 +349,10 @@ int ceph_open(struct inode *inode, struct file *file) return 0; } + err = generic_file_open(inode, file); + if (err) + return err; + /* filter out O_CREAT|O_EXCL; vfs did that already. yuck. */ flags = file->f_flags & ~(O_CREAT|O_EXCL); if (S_ISDIR(inode->i_mode))