Skip to content

Commit eafeefa

Browse files
committed
Fix NULL pointer dereference when reporting
checksum error for gang block in zio_done. Signed-off-by: Paul Zuchowski <[email protected]> Fixes #11872
1 parent b3530c4 commit eafeefa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

module/zfs/zio.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* Copyright (c) 2017, Intel Corporation.
2626
* Copyright (c) 2019, Klara Inc.
2727
* Copyright (c) 2019, Allan Jude
28+
* Copyright (c) 2021, Datto, Inc.
2829
*/
2930

3031
#include <sys/sysmacros.h>
@@ -4539,7 +4540,7 @@ zio_done(zio_t *zio)
45394540
uint64_t asize = P2ROUNDUP(psize, align);
45404541
abd_t *adata = zio->io_abd;
45414542

4542-
if (asize != psize) {
4543+
if (adata != NULL && asize != psize) {
45434544
adata = abd_alloc(asize, B_TRUE);
45444545
abd_copy(adata, zio->io_abd, psize);
45454546
abd_zero_off(adata, psize, asize - psize);
@@ -4550,7 +4551,7 @@ zio_done(zio_t *zio)
45504551
zcr->zcr_finish(zcr, adata);
45514552
zfs_ereport_free_checksum(zcr);
45524553

4553-
if (asize != psize)
4554+
if (adata != NULL && asize != psize)
45544555
abd_free(adata);
45554556
}
45564557
}

0 commit comments

Comments
 (0)