mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-08 02:15:20 +02:00
btrfs: send: handle unexpected data in header buffer in begin_cmd()
[ Upstream commit e80e3f732c
]
Change BUG_ON to a proper error handling in the unlikely case of seeing
data when the command is started. This is supposed to be reset when the
command is finished (send_cmd, send_encoded_extent).
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
46ca3ec9b8
commit
4eb8be942e
|
@ -777,7 +777,12 @@ static int begin_cmd(struct send_ctx *sctx, int cmd)
|
||||||
if (WARN_ON(!sctx->send_buf))
|
if (WARN_ON(!sctx->send_buf))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
BUG_ON(sctx->send_size);
|
if (unlikely(sctx->send_size != 0)) {
|
||||||
|
btrfs_err(sctx->send_root->fs_info,
|
||||||
|
"send: command header buffer not empty cmd %d offset %llu",
|
||||||
|
cmd, sctx->send_off);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
sctx->send_size += sizeof(*hdr);
|
sctx->send_size += sizeof(*hdr);
|
||||||
hdr = (struct btrfs_cmd_header *)sctx->send_buf;
|
hdr = (struct btrfs_cmd_header *)sctx->send_buf;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user