Skip to content

Commit 7346105

Browse files
committed
Merge tag 'erofs-for-6.10-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs
Pull erofs fixes from Gao Xiang: "The most important one fixes possible infinite loops reported by a smartphone vendor OPPO recently due to some unexpected zero-sized compressed pcluster out of interrupted I/Os, storage failures, etc. Another patch fixes global buffer memory leak on unloading, and the remaining one switches to use super_set_uuid() to keep with the other filesystems. Summary: - Fix possible global buffer memory leak when unloading EROFS module - Fix FS_IOC_GETFSUUID ioctl by using super_set_uuid() - Reset m_llen to 0 so then it can retry if metadata is invalid" * tag 'erofs-for-6.10-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs: erofs: ensure m_llen is reset to 0 if metadata is invalid erofs: convert to use super_set_uuid to support for FS_IOC_GETFSUUID erofs: fix possible memory leak in z_erofs_gbuf_exit()
2 parents 1dfe225 + 9b32b06 commit 7346105

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

fs/erofs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static int erofs_read_superblock(struct super_block *sb)
343343
sbi->build_time = le64_to_cpu(dsb->build_time);
344344
sbi->build_time_nsec = le32_to_cpu(dsb->build_time_nsec);
345345

346-
memcpy(&sb->s_uuid, dsb->uuid, sizeof(dsb->uuid));
346+
super_set_uuid(sb, (void *)dsb->uuid, sizeof(dsb->uuid));
347347

348348
ret = strscpy(sbi->volume_name, dsb->volume_name,
349349
sizeof(dsb->volume_name));

fs/erofs/zmap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,8 @@ int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
711711

712712
err = z_erofs_do_map_blocks(inode, map, flags);
713713
out:
714+
if (err)
715+
map->m_llen = 0;
714716
trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err);
715717
return err;
716718
}

fs/erofs/zutil.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ int __init z_erofs_gbuf_init(void)
148148

149149
void z_erofs_gbuf_exit(void)
150150
{
151-
int i;
151+
int i, j;
152152

153153
for (i = 0; i < z_erofs_gbuf_count + (!!z_erofs_rsvbuf); ++i) {
154154
struct z_erofs_gbuf *gbuf = &z_erofs_gbufpool[i];
@@ -161,9 +161,9 @@ void z_erofs_gbuf_exit(void)
161161
if (!gbuf->pages)
162162
continue;
163163

164-
for (i = 0; i < gbuf->nrpages; ++i)
165-
if (gbuf->pages[i])
166-
put_page(gbuf->pages[i]);
164+
for (j = 0; j < gbuf->nrpages; ++j)
165+
if (gbuf->pages[j])
166+
put_page(gbuf->pages[j]);
167167
kfree(gbuf->pages);
168168
gbuf->pages = NULL;
169169
}

0 commit comments

Comments
 (0)