Skip to content

Commit df04ebd

Browse files
PaulZ-98RageLtMan
authored andcommitted
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 openzfs#11872 Closes openzfs#11896
1 parent 6587390 commit df04ebd

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>
@@ -4559,7 +4560,7 @@ zio_done(zio_t *zio)
45594560
uint64_t asize = P2ROUNDUP(psize, align);
45604561
abd_t *adata = zio->io_abd;
45614562

4562-
if (asize != psize) {
4563+
if (adata != NULL && asize != psize) {
45634564
adata = abd_alloc(asize, B_TRUE);
45644565
abd_copy(adata, zio->io_abd, psize);
45654566
abd_zero_off(adata, psize, asize - psize);
@@ -4570,7 +4571,7 @@ zio_done(zio_t *zio)
45704571
zcr->zcr_finish(zcr, adata);
45714572
zfs_ereport_free_checksum(zcr);
45724573

4573-
if (asize != psize)
4574+
if (adata != NULL && asize != psize)
45744575
abd_free(adata);
45754576
}
45764577
}

0 commit comments

Comments
 (0)