diff options
author | Paul Zuchowski <[email protected]> | 2021-04-16 14:00:53 -0400 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2021-06-23 13:22:14 -0700 |
commit | 9755cdfd89ad6bc6c863e79467d4e4970de26233 (patch) | |
tree | ce41c3b37790633ceaef90633de156ed897d21b2 | |
parent | f36e8118fd9700c0cef8536d9dfde7c37dea2525 (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
-rw-r--r-- | module/zfs/zio.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 052fa7ec3..fa1d3635d 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> @@ -4499,7 +4500,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); @@ -4510,7 +4511,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); } } |