Skip to content

Commit

Permalink
Verify parent_dev before calling udev_device_get_sysattr_value
Browse files Browse the repository at this point in the history
Not all udev devices have parent devices.
Calling udev_device_get_ functions yield an assertion error
if called with a NULL pointer.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Sietse <[email protected]>
Co-authored-by: Sietse <[email protected]>
Closes openzfs#16705 
Closes openzfs#16717
  • Loading branch information
Uglymotha authored and behlendorf committed Nov 5, 2024
1 parent 55cbd1f commit b96845b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/zed/zed_disk_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b96845b

Please sign in to comment.