From 2c2cffafcace3cd4f9a226f96bd5ab21a6f42ab2 Mon Sep 17 00:00:00 2001 From: Sietse Date: Sun, 3 Nov 2024 17:22:17 +0000 Subject: [PATCH] Verify parent_dev before calling udev_device_get_sysattr_value Fixes: https://github.com/openzfs/zfs/issues/16705 Not all udev devices have parent devices. Calling udev_device_get_ functions yield an assertion error if called with a NULL pointer. Changes to be committed: modified: cmd/zed/zed_disk_event.c Signed-off-by: Sietse --- cmd/zed/zed_disk_event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/zed/zed_disk_event.c b/cmd/zed/zed_disk_event.c index 32a8789d3001..4a2b7398e922 100644 --- a/cmd/zed/zed_disk_event.c +++ b/cmd/zed/zed_disk_event.c @@ -139,7 +139,8 @@ dev_event_nvlist(struct udev_device *dev) * is /dev/sda. */ struct udev_device *parent_dev = udev_device_get_parent(dev); - if ((value = udev_device_get_sysattr_value(parent_dev, "size")) + if (parent_dev != NULL && + (value = udev_device_get_sysattr_value(parent_dev, "size")) != NULL) { uint64_t numval = DEV_BSIZE;