Skip to contentSkip to conversation

ubifs: mount fails after power cycle

PATCH In review Ravi Minnikanti 2 participants 2 messages Jul 30, 2024 – Jul 31, 2024 UBI file system (UBIFS)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ubifs: mount fails after power cycle

When kernel uses file system encryption, fscrypt on UBIFS v5,
after a hard power cycle UBIFS journal replay fails which results in mount failure.

Failure logs:
UBIFS: recovery needed
UBIFS error (pid 0): ubifs_validate_entry: bad directory entry node
UBIFS error (pid 0): replay_bud: bad node is at LEB 890:24576
UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'ubi0:rootfs' errno=-22!

This change is ported from kernel:
commit id: 304790c038bc4af4f19774705409db27eafb09fc

Kernel commit description:
Kernel commit description:
ubifs: Relax checks in ubifs_validate_entry()

With encrypted filenames we store raw binary data, doing string tests is no longer possible.

~

Change-Id I487ae4d172e228e72ac31d158d668f209142bce0
---
 fs/ubifs/replay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ubifs/replay.c +1 -1
index aa7f281ef6..b6e03b76d4 100644
@@ -451,7 +451,7 @@ int ubifs_validate_entry(struct ubifs_info *c,
 	if (le32_to_cpu(dent->ch.len) != nlen + UBIFS_DENT_NODE_SZ + 1 ||
 	    dent->type >= UBIFS_ITYPES_CNT ||
 	    nlen > UBIFS_MAX_NLEN || dent->name[nlen] != 0 ||
-	    strnlen(dent->name, nlen) != nlen ||
+	    (key_type == UBIFS_XENT_KEY && strnlen(dent->name, nlen) != nlen) ||
 	    le64_to_cpu(dent->inum) > MAX_INUM) {
 		ubifs_err(c, "bad %s node", key_type == UBIFS_DENT_KEY ?
 			  "directory entry" : "extended attribute entry");
Signature · 4 lines
2.25.1

Thanks,
Ravi
Reviewed-by on v1 1/1
#1 lore raw

Hello Ravi,

Quoted 20 lines · Ravi Minnikanti

When kernel uses file system encryption, fscrypt on UBIFS v5,
after a hard power cycle UBIFS journal replay fails which results in mount failure.

Failure logs:
UBIFS: recovery needed
UBIFS error (pid 0): ubifs_validate_entry: bad directory entry node
UBIFS error (pid 0): replay_bud: bad node is at LEB 890:24576
UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'ubi0:rootfs' errno=-22!

This change is ported from kernel:
commit id: 304790c038bc4af4f19774705409db27eafb09fc

Kernel commit description:
Kernel commit description:
ubifs: Relax checks in ubifs_validate_entry()

With encrypted filenames we store raw binary data, doing string tests is no longer possible.

Quoted 7 lines

~

Change-Id I487ae4d172e228e72ac31d158d668f209142bce0
---
  fs/ubifs/replay.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Good catch, thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]