summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorPaul Zuchowski <[email protected]>2021-04-16 14:00:53 -0400
committerBrian Behlendorf <[email protected]>2021-04-19 15:22:57 -0700
commitd938c6ee27dc11e2b6020c20afd87e21a84a1c10 (patch)
treefd6ff3cde43b3301ffdc653e64b1d7ad86886a34 /module/zfs
parentdc4d55268c9ae113fce6b8e2bb8ef1e7094fa284 (diff)
Fix crash in zio_done error reporting
Fix NULL pointer dereference when reporting checksum error for gang block in zio_done. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Paul Zuchowski <[email protected]> Closes #11872 Closes #11896
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index d97c8ddc9..5f56f67ff 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -25,6 +25,7 @@
* Copyright (c) 2017, Intel Corporation.
* Copyright (c) 2019, Klara Inc.
* Copyright (c) 2019, Allan Jude
+ * Copyright (c) 2021, Datto, Inc.
*/
#include <sys/sysmacros.h>
@@ -4539,7 +4540,7 @@ zio_done(zio_t *zio)
uint64_t asize = P2ROUNDUP(psize, align);
abd_t *adata = zio->io_abd;
- if (asize != psize) {
+ if (adata != NULL && asize != psize) {
adata = abd_alloc(asize, B_TRUE);
abd_copy(adata, zio->io_abd, psize);
abd_zero_off(adata, psize, asize - psize);
@@ -4550,7 +4551,7 @@ zio_done(zio_t *zio)
zcr->zcr_finish(zcr, adata);
zfs_ereport_free_checksum(zcr);
- if (asize != psize)
+ if (adata != NULL && asize != psize)
abd_free(adata);
}
}