From patchwork Tue Sep 18 13:34:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10604337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 741FA13AD for ; Tue, 18 Sep 2018 13:34:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 645CF2ABB1 for ; Tue, 18 Sep 2018 13:34:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58E892ABBB; Tue, 18 Sep 2018 13:34:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 1517D2ABB1 for ; Tue, 18 Sep 2018 13:34:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729807AbeIRTH2 (ORCPT ); Tue, 18 Sep 2018 15:07:28 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:38338 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728575AbeIRTH2 (ORCPT ); Tue, 18 Sep 2018 15:07:28 -0400 Received: by mail-wm1-f68.google.com with SMTP id t25-v6so2812592wmi.3; Tue, 18 Sep 2018 06:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8AB/jHoZeP+q5PUe4mASYh6f89Fllz8XrUKUvYedphI=; b=MAOwsvdNoLB7Re3VSxgpFXZ6DcCJ5eyHxbbYxUtuaRu2f/ia1Zu9VApcdSo8f39GFy ME3Fy8n8IdHisty2VHs+daIF/EraOlnqCJsSjZeB4AJwOmX2UB5OnSh9xJQInOlkB8zW NtuOQCknXCBJxWNIRZ1lNj8YN0lUyeqAaG53aimmKUrnqB7KOS+XjGg9H2wOVo6nZswE Yffpphuuv+eyQdYuWwKH+fiX3j+g0dnA+BfF2p671++uk8ozdw0wp4Y4r+YJ7IbLUbxn pstgZgoQj144ylW3Kr0gNVRXO04A9FJOpYnrxK5o5RmhHtAUpgqNbZ0H9X4/a0yhi4zO z5eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8AB/jHoZeP+q5PUe4mASYh6f89Fllz8XrUKUvYedphI=; b=VgWtU0X0hIzaSY1COF19NCcZgwFncXKUh0bRUqdPBN9m8dYQises0qV8uoaHgA7YkZ G8bvZX9x7Za3nZcwa8XZkdi3EcBwvlE5bnMGIG4W7+BnDT/LFVfAo17PPHwqwB3JWo7t ikrElXV3QV5/txx+YAG5cXE+pSyFxcMS2G0+xdMcifLwiNmiuNdXtLuR5+4lh3f5NetS J8S9fc8TUvnckWl3XnVoUvKH099ZNAkV3NJcAHwHBGOqKGDNiKpJfnLq3b4D57niIFrv 0WfKtpOrDlQEC8eNY6ifrGASXWhaTeX2p/xpupNZykNOz/b8yC1fe/Ds4D24dqhR5o1r BrYQ== X-Gm-Message-State: APzg51BoDz9ZkZ+o30Kun4Y0Wmy/gaM0oTaLzOYmIvtMtzDbdXWtPEtV BHdmRY1CmwSYsZ9WYEtwwBc= X-Google-Smtp-Source: ANB0VdYokxWRVW3OH+kSbD2aRQl0L0p7zeC1ppAy0eCx2xud5Faezuy8W2jTuP/n8RDIEXoTfNHd9g== X-Received: by 2002:a1c:9808:: with SMTP id a8-v6mr15358072wme.62.1537277688719; Tue, 18 Sep 2018 06:34:48 -0700 (PDT) Received: from localhost.localdomain ([141.226.14.107]) by smtp.gmail.com with ESMTPSA id h7-v6sm16905065wrs.3.2018.09.18.06.34.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Sep 2018 06:34:48 -0700 (PDT) From: Amir Goldstein To: Miklos Szeredi Cc: Al Viro , linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 3/4] ovl: fix freeze protection bypass in ovl_clone_file_range() Date: Tue, 18 Sep 2018 16:34:33 +0300 Message-Id: <20180918133434.27437-4-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180918133434.27437-1-amir73il@gmail.com> References: <20180918133434.27437-1-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Tested by doing clone on overlayfs while upper xfs+reflink is frozen: xfs_io -f /ovl/y fsfreeze -f /xfs xfs_io> reflink /ovl/x Before the fix xfs_io enters xfs_reflink_remap_range() and blocks in xfs_trans_alloc(). After the fix, xfs_io blocks outside xfs code in ovl_clone_file_range(). Fixes: 8ede205541ff ("ovl: add reflink/copyfile/dedup support") Signed-off-by: Amir Goldstein --- fs/overlayfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index 986313da0c88..5d1b4b38f743 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -461,7 +461,7 @@ static ssize_t ovl_copyfile(struct file *file_in, loff_t pos_in, break; case OVL_CLONE: - ret = vfs_clone_file_range(real_in.file, pos_in, + ret = do_clone_file_range(real_in.file, pos_in, real_out.file, pos_out, len); break;