Skip to contentSkip to conversation

erofs-utils: lib: fix packed xattr prefix seek

PATCH New Vansh Choudhary 1 participant 1 message Apr 9 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 erofs-utils: lib: fix packed xattr prefix seek

erofs_xattr_flush_name_prefixes() records the current packed file offset, writes xattr prefixes with erofs_io_pwrite(), and then seeks back to the new absolute end position.

Use SEEK_SET for that final lseek(). SEEK_CUR adds the tracked offset to the unchanged file position and can leave the packed file offset too far forward.

---
 lib/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/xattr.c +1 -1
index 565070a..9247004 100644
@@ -946,7 +946,7 @@ int erofs_xattr_flush_name_prefixes(struct erofs_importer *im, bool plain)
 		erofs_bdrop(bh, false);
 	} else {
 		DBG_BUGON(bmgr);
-		if (lseek(vf->fd, offset, SEEK_CUR) < 0)
+		if (lseek(vf->fd, offset, SEEK_SET) < 0)
 			return -errno;
 	}
 	erofs_sb_set_xattr_prefixes(sbi);
Signature · 1 line
2.43.0