Re: [PATCH i-g-t v3] tests/sw_sync: fix invalid fd test
Kamil Konieczny <[email protected]>
| Newsgroups | org.freedesktop.lists.igt-dev |
|---|---|
| Message-ID | <[email protected]> |
Hi Luka, On 2026-08-15 at 16:21:33 +0200, Luka Mamrikishvili wrote: > The invalid file fd test overwrites the file descriptor returned by > mkstemp() with a DRM device file descriptor. As a result, it tests a > device fd twice instead of testing a regular file fd, and leaks both > the first device fd and temporary file fd. > > Close the device fd after its test and retain the temporary file fd > for the file fd test. > > Signed-off-by: Luka Mamrikishvili <[email protected]> > Reviewed-by: Kamil Konieczny <[email protected]> Applied, thanks! Regards, Kamil > --- > v3: > - Use drm_close_driver() for the fd returned by drm_open_driver(). > - Add Reviewed-by: Kamil Konieczny <[email protected]>. > > v2: > - Add the i-g-t subject tag for CI. > > tests/sw_sync.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tests/sw_sync.c b/tests/sw_sync.c > index 8012652d6..2df6b5601 100644 > --- a/tests/sw_sync.c > +++ b/tests/sw_sync.c > @@ -334,6 +334,7 @@ static void test_sync_merge_invalid(void) > fence_invalid = drm_open_driver(DRIVER_ANY); > fence_merge = sync_fence_merge(in_fence, fence_invalid); > igt_assert_f(fence_merge < 0, "Verify invalid fd (device fd) handling"); > + drm_close_driver(fence_invalid); > > fence_invalid = mkstemp(tmppath); > if (fence_invalid == -1) { > @@ -341,7 +342,6 @@ static void test_sync_merge_invalid(void) > goto out; > } > unlink(tmppath); > - fence_invalid = drm_open_driver(DRIVER_ANY); > fence_merge = sync_fence_merge(in_fence, fence_invalid); > close(fence_invalid); > igt_assert_f(fence_merge < 0, "Verify invalid fd (file fd) handling"); > -- > 2.55.0 >