diff options
| author | Dustin Lundquist | 2019-10-28 16:52:06 +0000 |
|---|---|---|
| committer | Rafał Miłecki | 2019-11-04 10:49:30 +0000 |
| commit | 3aa051b44177fc1403acab295f9f833451c4b9f0 (patch) | |
| tree | 765154898151fdada3c0fa04a9f51d2c5bc9a249 | |
| parent | f47622e89c4d681a6441a3e51c0369f2baaaa1e6 (diff) | |
| download | procd-3aa051b44177fc1403acab295f9f833451c4b9f0.tar.gz | |
system: sysupgrade: close input side of pipe before reading
When /usr/libexec/validate_firmware_image is not present on the system
procd will hang indefinitely on the read() since the input side of the
pipe is still open.
Also fix pipe file descriptor leak when fork() fails.
Signed-off-by: Dustin Lundquist <d.lundquist@temperednetworks.com>
Acked-by: Rafał Miłecki <rafal@milecki.pl>
| -rw-r--r-- | system.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -434,6 +434,8 @@ static int validate_firmware_image_call(const char *file) switch (fork()) { case -1: + close(fds[0]); + close(fds[1]); return -errno; case 0: /* Set stdin & stderr to /dev/null */ @@ -454,11 +456,11 @@ static int validate_firmware_image_call(const char *file) } /* Parent process */ + close(fds[1]); tok = json_tokener_new(); if (!tok) { close(fds[0]); - close(fds[1]); return -ENOMEM; } @@ -476,7 +478,6 @@ static int validate_firmware_image_call(const char *file) } close(fds[0]); - close(fds[1]); err = -ENOENT; if (jsobj) { |