lib/cobalt: Fix possible fd leak in __map_umm
PATCH 1/1 lib/cobalt: Fix possible fd leak in __map_umm
In case the MEMDEV_RTIOC_STAT fails we have to close the file descriptor.
Signed-off-by Florian Bezdeka <[email protected]>
---
Note: This patch applies to all stable branches as well.
lib/cobalt/umm.c | 1 + 1 file changed, 1 insertion(+)
lib/cobalt/umm.c +1 -0
@@ -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 ;
Signature · 1 line
2.39.2
Jan Kiszka
AppliedQuoted 16 lines · Florian Bezdeka
In case the
MEMDEV_RTIOC_STATfails we have to close the file descriptor.Signed-off-by Florian Bezdeka <[email protected]>---
Note: This patch applies to all stable branches as well.
lib/cobalt/umm.c | 1 + 1 file changed, 1 insertion(+)lib/cobalt/umm.c +0
-0
lib/cobalt/umm.c static void *__map_umm(const char *name, uint32_t *size_r) · line 65
Quoted 7 lines
lib/cobalt/umm.c +1
-0@@ -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
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux