linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()
@ 2020-01-19 21:52 Richard Weinberger
  2020-04-29 14:56 ` John Ogness
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2020-01-19 21:52 UTC (permalink / raw)
  To: linux-mtd; +Cc: linux-kernel, Richard Weinberger

Orphans are allowed to point to deleted inodes.
So -ENOENT is not a fatal error.

Reported-by: Кочетков Максим <fido_max@inbox.ru>
Reported-and-tested-by: "Christian Berger" <Christian.Berger@de.bosch.com>
Fixes: ee1438ce5dc4 ("ubifs: Check link count of inodes when killing orphans.")
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/orphan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
index 54d6db61106f..2645917360b9 100644
--- a/fs/ubifs/orphan.c
+++ b/fs/ubifs/orphan.c
@@ -688,14 +688,14 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
 
 			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);
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-30  7:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-19 21:52 [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() Richard Weinberger
2020-04-29 14:56 ` John Ogness
2020-04-29 15:03   ` Richard Weinberger
2020-04-29 18:51   ` Please queue ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() for stable (was: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()) Richard Weinberger
2020-04-30  7:11     ` Greg KH
2020-04-30  7:41       ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).