On Thu, Jan 28, 2021 at 10:08:52PM +0100, [email protected] wrote:
> From: Martin Wilck <[email protected]>
> 
> Crashes have been observed in the unwinder stack of uevent_listen().
> This can only be explained by "udev" not being a valid object at that
> time. Be sure to pass a valid pointer, and don't call udev_unref() if
> it has been set to NULL already.
> 
> I'm not quite sure how this would come to pass, as we join the threads
> before setting udev to NULL, but this is unwinder code, so I guess it
> might actually be executed after the thread has terminated.
> 
> Signed-off-by: Martin Wilck <[email protected]>

Assuming that this does resolve the issue,

Reviewed-by: Benjamin Marzinski <[email protected]>
> ---
>  libmultipath/uevent.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
> index d3061bf..4e662ff 100644
> --- a/libmultipath/uevent.c
> +++ b/libmultipath/uevent.c
> @@ -397,10 +397,11 @@ service_uevq(struct list_head *tmpq)
>  
>  static void uevent_cleanup(void *arg)
>  {
> -     struct udev *udev = arg;
> +     struct udev **pudev = arg;
>  
> +     if (*pudev)
> +             udev_unref(*pudev);
>       condlog(3, "Releasing uevent_listen() resources");
> -     udev_unref(udev);
>  }
>  
>  static void monitor_cleanup(void *arg)
> @@ -560,7 +561,7 @@ int uevent_listen(struct udev *udev)
>               return 1;
>       }
>       udev_ref(udev);
> -     pthread_cleanup_push(uevent_cleanup, udev);
> +     pthread_cleanup_push(uevent_cleanup, &udev);
>  
>       monitor = udev_monitor_new_from_netlink(udev, "udev");
>       if (!monitor) {
> -- 
> 2.29.2

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to