cmd_migrate: Fix small UAF
Some checks failed
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-07-05 11:33:49 -04:00
parent 7c0c6c812b
commit b392d55d4a

View File

@ -244,7 +244,6 @@ static int migrate_fs(const char *fs_path,
find_superblock_space(extents, format_opts, dev);
struct bch_sb *sb = bch2_format(fs_opt_strs, fs_opts, format_opts, devs);
darray_exit(&devs);
u64 sb_offset = le64_to_cpu(sb->layout.sb_offset[0]);
@ -316,6 +315,8 @@ static int migrate_fs(const char *fs_path,
"no longer needed (and should be deleted prior to running\n"
"bcachefs migrate-superblock)\n",
sb_offset, dev->path, dev->path, sb_offset);
darray_exit(&devs);
return 0;
}