aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2023-02-23 13:19:08 -0500
committerGitHub <[email protected]>2023-02-23 10:19:08 -0800
commit7cb67d627c0c258a5dedb5b0d1f979469e51c91a (patch)
tree046fc2e4717fd633b5b246a49313a7c3de736455 /module/zfs
parentc9e39da9a42a863141fd41c031ac7cee0253635b (diff)
Fix NULL pointer dereference in zio_ready()
Clang's static analyzer correctly identified a NULL pointer dereference in zio_ready() when ZIO_FLAG_NODATA has been set on a zio that is missing a block pointer. The NULL pointer dereference occurs because we have logic intended to disable ZIO_FLAG_NODATA when it has been set on a gang block. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Brian Atkinson <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14469
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index d888a584a..19b222dfe 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -4431,7 +4431,7 @@ zio_ready(zio_t *zio)
}
if (zio->io_flags & ZIO_FLAG_NODATA) {
- if (BP_IS_GANG(bp)) {
+ if (bp != NULL && BP_IS_GANG(bp)) {
zio->io_flags &= ~ZIO_FLAG_NODATA;
} else {
ASSERT((uintptr_t)zio->io_abd < SPA_MAXBLOCKSIZE);