Skip to content

Commit eb5f469

Browse files
PaulZ-98Ryan Moeller
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 f0caa0f commit eb5f469

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>
@@ -4503,7 +4504,7 @@ zio_done(zio_t *zio)
45034504
uint64_t asize = P2ROUNDUP(psize, align);
45044505
abd_t *adata = zio->io_abd;
45054506

4506-
if (asize != psize) {
4507+
if (adata != NULL && asize != psize) {
45074508
adata = abd_alloc(asize, B_TRUE);
45084509
abd_copy(adata, zio->io_abd, psize);
45094510
abd_zero_off(adata, psize, asize - psize);
@@ -4514,7 +4515,7 @@ zio_done(zio_t *zio)
45144515
zcr->zcr_finish(zcr, adata);
45154516
zfs_ereport_free_checksum(zcr);
45164517

4517-
if (asize != psize)
4518+
if (adata != NULL && asize != psize)
45184519
abd_free(adata);
45194520
}
45204521
}

0 commit comments

Comments
 (0)