Re: [PATCH v2] selftests/x86/lam: fix resource leak in do_uring() and allocate_dsa_pasid()
From: Ingo Molnar
Date: Mon Apr 07 2025 - 15:05:57 EST
* Malaya Kumar Rout <malayarout91@xxxxxxxxx> wrote:
> @@ -1189,9 +1191,10 @@ void *allocate_dsa_pasid(void)
>
> wq = mmap(NULL, 0x1000, PROT_WRITE,
> MAP_SHARED | MAP_POPULATE, fd, 0);
> - if (wq == MAP_FAILED)
> + if (wq == MAP_FAILED){
> + close(fd);
> perror("mmap");
We should unconditionally close 'fd' after the mmap() call, not just in
the perror() branch.
Thanks,
Ingo