Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp755107pxb; Tue, 5 Apr 2022 21:55:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylOfFaA6RfdkFc88Y1ZjnNhPSdmPJjoeWFgTtFcibuG8ZrH4AQmDJa9FejwGdoeFoC/8Wd X-Received: by 2002:a17:902:c7d5:b0:156:878e:f876 with SMTP id r21-20020a170902c7d500b00156878ef876mr6463402pla.165.1649220937127; Tue, 05 Apr 2022 21:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649220937; cv=none; d=google.com; s=arc-20160816; b=vd07uokXwfH/V+B+niBiDg9BTnhr5inZNhGCKY6JOEl7AAtle2ZIQxQ2w2XGMcBTKc 8+08G8n1F0FrQz7PcoOkLIMlAhycal+ga8L5drKw+d8DEood7Qw01aSrhmuJi8yhTqhC QZrJQaCKWVXh7p//ko7BfgpNQIsYK7h6SUpyx5DNHE25X5loB7k/BOSNMPeM58QPt6M8 Jo9sfjbteCoecaM4/atJTBbI59CqcnEHygh4IdT2oMN5klf7K+AXQsPqYqFSYtfAjcE+ aU8T8d5ELBJCxh/dug4vvHQblMdgm7JdJeUicMumSAjxZ/7EqQvu6SRleHJfdphaXjc+ 9MoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e9ePK4aaJJaIjJOSdlHIISBurzGitZ4LkaUl8Xhx7sw=; b=0xXUT6zoNxere+pwP3gO5gNJRyUQi3QHhwktWRy77dr+Aaet5CIWJ9yCJ5lWG6Uosz b9q5BwRtYPMKXpnhySKFkzg/I2jV+q75sYWdFZMisoZgQhwlBRX+bFlyxlKD5nQwljFJ QYuRWm12bGMV5XHioTh/Es4GZorjrEr93lBvQzPUYkYKHZy1RnxYa67ar1htzhS44k7f 4KLRS0BlY2hebzv131Oh7dkFeXne8ho8jEZdaEnqtdmj11/3R2+uggsAlTA3IK4A1ABs FtSyiES2c70MMhQDwjqXn5Fnulvp3u8JAAIj0Q8sCKmJ837EFbKm+vM6hO9Nxh0p49kp sQQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sQbpsBnZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t15-20020a63460f000000b0038233e5c911si15069097pga.88.2022.04.05.21.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 21:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sQbpsBnZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5276815F575; Tue, 5 Apr 2022 20:16:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388999AbiDENwt (ORCPT + 99 others); Tue, 5 Apr 2022 09:52:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347516AbiDEJ1K (ORCPT ); Tue, 5 Apr 2022 05:27:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 272B2DF49A; Tue, 5 Apr 2022 02:15:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A2034B81B62; Tue, 5 Apr 2022 09:15:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EADF6C385A0; Tue, 5 Apr 2022 09:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150130; bh=jl6Snp2v0QTf7bMzCJgP0Dv9BzB/beZVOt0Nxq39c78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQbpsBnZ8BhjwAkaFseItpMRg1DuoLfArKtt4YhEkoyQl7QGU0NTyzSkipvGyPezq KT0Cn1NLjRjQ8OptCr4RlaszAlywdMEKVwkMp9cSuyl3LcUsFEEeK4K/gY65nwMsJw 7J7HHIwx2CSeBl/g0oX+NKlGyK2/SxSoDsoLGw44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Baokun Li , Richard Weinberger Subject: [PATCH 5.16 0916/1017] ubifs: rename_whiteout: correct old_dir size computing Date: Tue, 5 Apr 2022 09:30:29 +0200 Message-Id: <20220405070421.410357296@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Baokun Li commit 705757274599e2e064dd3054aabc74e8af31a095 upstream. When renaming the whiteout file, the old whiteout file is not deleted. Therefore, we add the old dentry size to the old dir like XFS. Otherwise, an error may be reported due to `fscki->calc_sz != fscki->size` in check_indes. Fixes: 9e0a1fff8db56ea ("ubifs: Implement RENAME_WHITEOUT") Reported-by: Zhihao Cheng Signed-off-by: Baokun Li Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/dir.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -1402,6 +1402,9 @@ static int do_rename(struct inode *old_d iput(whiteout); goto out_release; } + + /* Add the old_dentry size to the old_dir size. */ + old_sz -= CALC_DENT_SIZE(fname_len(&old_nm)); } lock_4_inodes(old_dir, new_dir, new_inode, whiteout);