Commit 73461051 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents 1dfe225e 9b32b063
...@@ -343,7 +343,7 @@ static int erofs_read_superblock(struct super_block *sb) ...@@ -343,7 +343,7 @@ static int erofs_read_superblock(struct super_block *sb)
sbi->build_time = le64_to_cpu(dsb->build_time); sbi->build_time = le64_to_cpu(dsb->build_time);
sbi->build_time_nsec = le32_to_cpu(dsb->build_time_nsec); sbi->build_time_nsec = le32_to_cpu(dsb->build_time_nsec);
memcpy(&sb->s_uuid, dsb->uuid, sizeof(dsb->uuid)); super_set_uuid(sb, (void *)dsb->uuid, sizeof(dsb->uuid));
ret = strscpy(sbi->volume_name, dsb->volume_name, ret = strscpy(sbi->volume_name, dsb->volume_name,
sizeof(dsb->volume_name)); sizeof(dsb->volume_name));
......
...@@ -711,6 +711,8 @@ int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map, ...@@ -711,6 +711,8 @@ int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
err = z_erofs_do_map_blocks(inode, map, flags); err = z_erofs_do_map_blocks(inode, map, flags);
out: out:
if (err)
map->m_llen = 0;
trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err); trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err);
return err; return err;
} }
......
...@@ -148,7 +148,7 @@ int __init z_erofs_gbuf_init(void) ...@@ -148,7 +148,7 @@ int __init z_erofs_gbuf_init(void)
void z_erofs_gbuf_exit(void) void z_erofs_gbuf_exit(void)
{ {
int i; int i, j;
for (i = 0; i < z_erofs_gbuf_count + (!!z_erofs_rsvbuf); ++i) { for (i = 0; i < z_erofs_gbuf_count + (!!z_erofs_rsvbuf); ++i) {
struct z_erofs_gbuf *gbuf = &z_erofs_gbufpool[i]; struct z_erofs_gbuf *gbuf = &z_erofs_gbufpool[i];
...@@ -161,9 +161,9 @@ void z_erofs_gbuf_exit(void) ...@@ -161,9 +161,9 @@ void z_erofs_gbuf_exit(void)
if (!gbuf->pages) if (!gbuf->pages)
continue; continue;
for (i = 0; i < gbuf->nrpages; ++i) for (j = 0; j < gbuf->nrpages; ++j)
if (gbuf->pages[i]) if (gbuf->pages[j])
put_page(gbuf->pages[i]); put_page(gbuf->pages[j]);
kfree(gbuf->pages); kfree(gbuf->pages);
gbuf->pages = NULL; gbuf->pages = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment