diff options
author | Alexander Motin <[email protected]> | 2023-11-28 16:35:14 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-28 13:35:14 -0800 |
commit | 2a27fd41115313169b204def8b8c7fc1f0476c65 (patch) | |
tree | 2f2fb25ca75ed0464aacd84d48742e51b95b7566 /module/zfs/zvol.c | |
parent | b94ce4e17d5138f4aaea098e78478be0fdc9424d (diff) |
ZIL: Assert record sizes in different places
This should make sure we have log written without overflows.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Sponsored by: iXsystems, Inc.
Closes #15517
Diffstat (limited to 'module/zfs/zvol.c')
-rw-r--r-- | module/zfs/zvol.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c index ac373379e..ce5b75462 100644 --- a/module/zfs/zvol.c +++ b/module/zfs/zvol.c @@ -446,6 +446,8 @@ zvol_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) lr_truncate_t *lr = arg2; uint64_t offset, length; + ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr)); + if (byteswap) byteswap_uint64_array(lr, sizeof (*lr)); @@ -482,6 +484,8 @@ zvol_replay_write(void *arg1, void *arg2, boolean_t byteswap) dmu_tx_t *tx; int error; + ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr)); + if (byteswap) byteswap_uint64_array(lr, sizeof (*lr)); @@ -535,6 +539,10 @@ zvol_replay_clone_range(void *arg1, void *arg2, boolean_t byteswap) uint_t ii; int error; + ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr)); + ASSERT3U(lr->lr_common.lrc_reclen, >=, offsetof(lr_clone_range_t, + lr_bps[lr->lr_nbps])); + dmu_objset_name(os, name); cmn_err(CE_WARN, "ZFS dropping block cloning transaction for %s.", name); |