aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorAlexander Motin <[email protected]>2023-06-17 22:51:37 -0400
committerGitHub <[email protected]>2023-06-17 19:51:37 -0700
commit8e8acabdcaeb831c777f71361722f4235b698a8d (patch)
tree1a8fc51134f100b7d16b5570621894e3d8764c6d /module/zfs
parent10e36e17612ba9c634b140ae76847bb62b5be68f (diff)
Fix memory leak in zil_parse().
482da24e2 missed arc_buf_destroy() calls on log parse errors, possibly leaking up to 128KB of memory per dataset during ZIL replay. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Paul Dagnelie <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes #14987
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zil.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/module/zfs/zil.c b/module/zfs/zil.c
index 8c1fe5f66..ee8dcce3b 100644
--- a/module/zfs/zil.c
+++ b/module/zfs/zil.c
@@ -522,12 +522,16 @@ zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
lr_t *lr = (lr_t *)lrp;
reclen = lr->lrc_reclen;
ASSERT3U(reclen, >=, sizeof (lr_t));
- if (lr->lrc_seq > claim_lr_seq)
+ if (lr->lrc_seq > claim_lr_seq) {
+ arc_buf_destroy(abuf, &abuf);
goto done;
+ }
error = parse_lr_func(zilog, lr, arg, txg);
- if (error != 0)
+ if (error != 0) {
+ arc_buf_destroy(abuf, &abuf);
goto done;
+ }
ASSERT3U(max_lr_seq, <, lr->lrc_seq);
max_lr_seq = lr->lrc_seq;
lr_count++;