mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
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 <behlendorf1@llnl.gov> Signed-off-by: Paul Zuchowski <pzuchowski@datto.com> Closes #11872 Closes #11896
This commit is contained in:
parent
d92af6fc8d
commit
f2286383d0
@ -25,6 +25,7 @@
|
|||||||
* Copyright (c) 2017, Intel Corporation.
|
* Copyright (c) 2017, Intel Corporation.
|
||||||
* Copyright (c) 2019, Klara Inc.
|
* Copyright (c) 2019, Klara Inc.
|
||||||
* Copyright (c) 2019, Allan Jude
|
* Copyright (c) 2019, Allan Jude
|
||||||
|
* Copyright (c) 2021, Datto, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
@ -4539,7 +4540,7 @@ zio_done(zio_t *zio)
|
|||||||
uint64_t asize = P2ROUNDUP(psize, align);
|
uint64_t asize = P2ROUNDUP(psize, align);
|
||||||
abd_t *adata = zio->io_abd;
|
abd_t *adata = zio->io_abd;
|
||||||
|
|
||||||
if (asize != psize) {
|
if (adata != NULL && asize != psize) {
|
||||||
adata = abd_alloc(asize, B_TRUE);
|
adata = abd_alloc(asize, B_TRUE);
|
||||||
abd_copy(adata, zio->io_abd, psize);
|
abd_copy(adata, zio->io_abd, psize);
|
||||||
abd_zero_off(adata, psize, asize - psize);
|
abd_zero_off(adata, psize, asize - psize);
|
||||||
@ -4550,7 +4551,7 @@ zio_done(zio_t *zio)
|
|||||||
zcr->zcr_finish(zcr, adata);
|
zcr->zcr_finish(zcr, adata);
|
||||||
zfs_ereport_free_checksum(zcr);
|
zfs_ereport_free_checksum(zcr);
|
||||||
|
|
||||||
if (asize != psize)
|
if (adata != NULL && asize != psize)
|
||||||
abd_free(adata);
|
abd_free(adata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user