Linux IOMMU Development
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: 2564278112@qq.com
Cc: Barry Song <baohua@kernel.org>, Qinxin Xia <xiaqinxin@huawei.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Wang Jiang <jiangwang@kylinos.cn>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma/dma_map_benchmark: fix fd leak on error and exit
Date: Thu, 21 May 2026 10:32:36 +0100	[thread overview]
Message-ID: <20260521103236.747dceef@pumpkin> (raw)
In-Reply-To: <tencent_E7BC2E2BDB10173E11B0FD519A84D414E509@qq.com>

On Thu, 21 May 2026 16:02:41 +0800
2564278112@qq.com wrote:

> From: Wang Jiang <jiangwang@kylinos.cn>
> 
> Close the file descriptor when ioctl fails and on normal exit
> to fix file descriptor leak.

There isn't a leak, it is all tidied up by the kernel.

-- David

> 
> Signed-off-by: Wang Jiang <jiangwang@kylinos.cn>
> ---
>  tools/dma/dma_map_benchmark.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/dma/dma_map_benchmark.c b/tools/dma/dma_map_benchmark.c
> index eab0ac611a23..bdb8a837f020 100644
> --- a/tools/dma/dma_map_benchmark.c
> +++ b/tools/dma/dma_map_benchmark.c
> @@ -130,6 +130,7 @@ int main(int argc, char **argv)
>  
>  	if (ioctl(fd, cmd, &map)) {
>  		perror("ioctl");
> +		close(fd);
>  		exit(1);
>  	}
>  
> @@ -140,5 +141,6 @@ int main(int argc, char **argv)
>  	printf("average unmap latency(us):%.1f standard deviation:%.1f\n",
>  			map.avg_unmap_100ns/10.0, map.unmap_stddev/10.0);
>  
> +	close(fd);
>  	return 0;
>  }


  reply	other threads:[~2026-05-21  9:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  8:02 [PATCH] dma/dma_map_benchmark: fix fd leak on error and exit 2564278112
2026-05-21  9:32 ` David Laight [this message]
2026-05-25  1:44   ` Qinxin Xia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260521103236.747dceef@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=2564278112@qq.com \
    --cc=baohua@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=jiangwang@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=xiaqinxin@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox