Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3109610pxb; Mon, 18 Apr 2022 16:11:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD50UUMjU+jxot9BGoFtZEQZjFsMLT0Et3Hoy4L0zbevWDkgufHAUiIwqqj52Oe3G0jcc3 X-Received: by 2002:a17:906:dc93:b0:6e8:8d81:b4bb with SMTP id cs19-20020a170906dc9300b006e88d81b4bbmr11085003ejc.32.1650323475095; Mon, 18 Apr 2022 16:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650323475; cv=none; d=google.com; s=arc-20160816; b=oyeMrLcgukvJ0Oe1Yfye2nySJS1ToFA8jxyHrOTk0URuG7dGpYOt64sOshnWCICLxO hlqJS9E8g23sCJw2S8dQT+e9jqaVjz8gPO/QUo4FJqI5kl2zLqGp9yyfsKZt12KDPTL4 eGqOKDotwvyUVtg4VHsdxZ/YWVzkGqHe10LpQa9SsnJn+o9rgRlYxrYn0VzSiE9Yrzr3 KAFfnrgG2LaGtqZj91npP5bUgZxOrlaEzqV1cFGLxbL+jsocqxG063R6eBpNMxlpWcz0 ZFRvBj5/GofIN03ykXxd//4ifjbQfWku/9K1vn/7HCHtihqybl4nv34TjnJZwopnU3KW kWgg== 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=ys2Hi6kFiDpYe73dPtoRw0Kq++ztoWoWYCfBKsL1GOg=; b=ezVSL2FqRvCmW70XXmqxejp/QrKcGyAHfPKBTzjlmeQa/CyCkJjfLZLU1ojgD2O9r9 18YG8YtsXifuah4HmH5ArwZcsPAWhFXO+HDkBB9O3yBvXTj6qYmicKLTokJ32dIbQ9iq zdHMPmv6nogblKB+C8EPJsV6ijQJg45C7SwKTUAWgvIdOFczC1CDX5hNgDJqBb5jVfC4 fMpdUvPVEVPAm1cnHvQvUJ1bW/O1HZM81Pd7RMcL5GfAHJSPUz9wHQFHOUXuiPeFDIQI OLz1mttB+uJzYc5eZiqn3MLSOQgkyyresVv0JmQQp7swRM3WA4PWZqi+tOnxnfA+27dh zi9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mvogsyMs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a056402438800b00423f62ce403si1431143edc.571.2022.04.18.16.10.48; Mon, 18 Apr 2022 16:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mvogsyMs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244407AbiDRNyq (ORCPT + 99 others); Mon, 18 Apr 2022 09:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244872AbiDRNa7 (ORCPT ); Mon, 18 Apr 2022 09:30:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 148E91EEF1; Mon, 18 Apr 2022 05:56:49 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A393460FD9; Mon, 18 Apr 2022 12:56:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 916F1C385A1; Mon, 18 Apr 2022 12:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286608; bh=RyYRvTh/gCaabpitJ9QTL82+jjl5OBhyZhWNKY8lAcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mvogsyMsPle8pu55q1MgFhhZv+Niey59jG2CZhGVVvDNwEjN5/1j8DQAgb+xe5MWR o0n+5LzsXsi8dKaCeYEDQXzAyAfrMkzI3zINmQTNWWgjT32+NwnJz5IKlC2ErrvvBr Yx3NFOqgZTuQLvoQ3nK/tD41ApmnI2Owes5pnSpY= 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 4.14 188/284] ubifs: rename_whiteout: correct old_dir size computing Date: Mon, 18 Apr 2022 14:12:49 +0200 Message-Id: <20220418121217.081930940@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@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=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 @@ -1452,6 +1452,9 @@ static int do_rename(struct inode *old_d if (unlink) drop_nlink(old_dir); } + + /* Add the old_dentry size to the old_dir size. */ + old_sz -= CALC_DENT_SIZE(fname_len(&old_nm)); } old_dir->i_size -= old_sz;