From patchwork Fri May 1 13:22:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 226644 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74695C47254 for ; Fri, 1 May 2020 13:37:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4463F24957 for ; Fri, 1 May 2020 13:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340274; bh=wbTdBVJuZ2QGIL3DoE3RkbBh6BRtM0pmebWeNOoD6qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dnaNa5K27kt7qU0MjaAA6fwfyP2fq/QQJlMrjH9nj2z9hgaVWbI7zRR3c2EQ2FVJT hGF9DRUkY5uJe20o23fcXNuYT1UWNdhb/XHqNorAbjkcrP5Il+coMyE2FvunyobCJ/ zAAJDyr2oeW6dYTmeSA0Hgq1fNHLVYVKSvHemBAs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729297AbgEANhw (ORCPT ); Fri, 1 May 2020 09:37:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:37104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730447AbgEANhu (ORCPT ); Fri, 1 May 2020 09:37:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93DDB2495A; Fri, 1 May 2020 13:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340270; bh=wbTdBVJuZ2QGIL3DoE3RkbBh6BRtM0pmebWeNOoD6qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YwKYePrPlJvKqpXmjNBKGDKbeu32QL35ISdF1N7P8MIMjPdGYKRUyBrydojwRu7dq 1ms5aD8iUCiQKzpkc4IbJOEQTtVYkgAIN+LNr6d5PwvxPy94uYVWX+pBW5f/bu+Imn 1tG0g67tBH24QXJT4J8bDcanYOP95O1+5EOjja8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?0JrQvtGH0LXRgtC60L7QsiDQnNCw0Lo=?= =?utf-8?b?0YHQuNC8?= , Karl Olsen , Jef Driesen , Richard Weinberger , Christian Eggers , "Christian Berger" Subject: [PATCH 5.4 02/83] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() Date: Fri, 1 May 2020 15:22:41 +0200 Message-Id: <20200501131524.703958316@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131524.004332640@linuxfoundation.org> References: <20200501131524.004332640@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Richard Weinberger commit 4ab25ac8b2b5514151d5f91cf9514df08dd26938 upstream. Orphans are allowed to point to deleted inodes. So -ENOENT is not a fatal error. Reported-by: Кочетков Максим Reported-and-tested-by: "Christian Berger" Tested-by: Karl Olsen Tested-by: Jef Driesen Fixes: ee1438ce5dc4 ("ubifs: Check link count of inodes when killing orphans.") Signed-off-by: Richard Weinberger Cc: Christian Eggers Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/orphan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c @@ -688,14 +688,14 @@ static int do_kill_orphans(struct ubifs_ ino_key_init(c, &key1, inum); err = ubifs_tnc_lookup(c, &key1, ino); - if (err) + if (err && err != -ENOENT) goto out_free; /* * Check whether an inode can really get deleted. * linkat() with O_TMPFILE allows rebirth of an inode. */ - if (ino->nlink == 0) { + if (err == 0 && ino->nlink == 0) { dbg_rcvry("deleting orphaned inode %lu", (unsigned long)inum);