Re: [igt-dev] [PATCH i-g-t 1/3] lib/igt_device_scan: Free filtered devices in igt_devices_free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 27, 2022 at 11:50:40AM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> 
> Fix a possible oversight.

Yes, properly coded in igt_device_scan() only. Thanks for spotting this.

> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> ---
>  lib/igt_device_scan.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> index 3c23fe0eb520..a30433ae2cff 100644
> --- a/lib/igt_device_scan.c
> +++ b/lib/igt_device_scan.c
> @@ -814,6 +814,11 @@ void igt_devices_free(void)
>  		igt_device_free(dev);
>  		free(dev);
>  	}
> +
> +	igt_list_for_each_entry_safe(dev, tmp, &igt_devs.filtered, link) {
> +		igt_list_del(&dev->link);
> +		free(dev);
> +	}

Small nit - I would change the order (filtered list I would remove first).
igt_device_free() also frees dev->devnode, ... so if we would change the 
code to be more "parallel" it would be better to avoid use-after-free.

With this:

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@xxxxxxxxx>

--
Zbigniew

>  }
>  
>  /**
> -- 
> 2.32.0
> 



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux