diff options
author | David Sterba <dsterba@suse.com> | 2024-02-07 00:47:13 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-03-04 18:24:51 +0300 |
commit | 5d2288711ccc483feca73151c46ee835bda17839 (patch) | |
tree | 56443b141a2d394ee0fcced5466fad8d8717ae19 /fs/btrfs | |
parent | e80e3f732cf53c64b0d811e1581470d67f6c3228 (diff) | |
download | linux-5d2288711ccc483feca73151c46ee835bda17839.tar.xz |
btrfs: send: handle unexpected inode in header process_recorded_refs()
Change BUG_ON to proper error handling when an unexpected inode number
is encountered. As the comment says this should never happen.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/send.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 8c3ca4a5d923..3b3f38a76b00 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -4186,7 +4186,13 @@ static int process_recorded_refs(struct send_ctx *sctx, int *pending_move) * This should never happen as the root dir always has the same ref * which is always '..' */ - BUG_ON(sctx->cur_ino <= BTRFS_FIRST_FREE_OBJECTID); + if (unlikely(sctx->cur_ino <= BTRFS_FIRST_FREE_OBJECTID)) { + btrfs_err(fs_info, + "send: unexpected inode %llu in process_recorded_refs()", + sctx->cur_ino); + ret = -EINVAL; + goto out; + } valid_path = fs_path_alloc(); if (!valid_path) { |