* [PATCH next,stable/3.0-3.2] lib/cobalt: Fix possible fd leak in __map_umm
@ 2023-04-19 8:03 Florian Bezdeka
2023-04-19 12:40 ` Jan Kiszka
0 siblings, 1 reply; 2+ messages in thread
From: Florian Bezdeka @ 2023-04-19 8:03 UTC (permalink / raw)
To: xenomai; +Cc: jan.kiszka, Florian Bezdeka
In case the MEMDEV_RTIOC_STAT fails we have to close the file
descriptor.
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
Note: This patch applies to all stable branches as well.
lib/cobalt/umm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/cobalt/umm.c b/lib/cobalt/umm.c
index 944620fee..c30ada6a2 100644
--- a/lib/cobalt/umm.c
+++ b/lib/cobalt/umm.c
@@ -59,6 +59,7 @@ static void *__map_umm(const char *name, uint32_t *size_r)
ret = __RT(ioctl(fd, MEMDEV_RTIOC_STAT, &statbuf));
if (ret) {
+ __RT(close(fd));
early_warning("failed getting status of %s: %s",
name, strerror(errno));
return MAP_FAILED;
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH next,stable/3.0-3.2] lib/cobalt: Fix possible fd leak in __map_umm
2023-04-19 8:03 [PATCH next,stable/3.0-3.2] lib/cobalt: Fix possible fd leak in __map_umm Florian Bezdeka
@ 2023-04-19 12:40 ` Jan Kiszka
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2023-04-19 12:40 UTC (permalink / raw)
To: Florian Bezdeka, xenomai
On 19.04.23 10:03, Florian Bezdeka wrote:
> In case the MEMDEV_RTIOC_STAT fails we have to close the file
> descriptor.
>
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
>
> Note: This patch applies to all stable branches as well.
>
> lib/cobalt/umm.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/cobalt/umm.c b/lib/cobalt/umm.c
> index 944620fee..c30ada6a2 100644
> --- a/lib/cobalt/umm.c
> +++ b/lib/cobalt/umm.c
> @@ -59,6 +59,7 @@ static void *__map_umm(const char *name, uint32_t *size_r)
>
> ret = __RT(ioctl(fd, MEMDEV_RTIOC_STAT, &statbuf));
> if (ret) {
> + __RT(close(fd));
> early_warning("failed getting status of %s: %s",
> name, strerror(errno));
> return MAP_FAILED;
Thanks, applied.
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-19 12:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 8:03 [PATCH next,stable/3.0-3.2] lib/cobalt: Fix possible fd leak in __map_umm Florian Bezdeka
2023-04-19 12:40 ` Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).