From 48625308a375a3d3e08446661491a8dd1fbf172d Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 16 Oct 2020 03:24:17 +0100 Subject: [PATCH] mount: restorecon: guard against execl() errors In the current implementation, in case of execl("/sbin/restorecon") failing, the child process will also return and that will lead to even more disasterous effects. Though it seems unlikely that execl() would fail given that the file exists, simply catch that case by exiting in case execl() returns. Signed-off-by: Daniel Golle --- libfstools/mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfstools/mount.c b/libfstools/mount.c index b30e5a6..1691ce7 100644 --- a/libfstools/mount.c +++ b/libfstools/mount.c @@ -99,7 +99,7 @@ selinux_restorecon(char *overlaydir) restorecon_pid = fork(); if (!restorecon_pid) - execl("/sbin/restorecon", "restorecon", overlaydir, (char *) NULL); + exit(execl("/sbin/restorecon", "restorecon", overlaydir, (char *) NULL)); else if (restorecon_pid > 0) waitpid(restorecon_pid, &status, 0); } -- 2.30.2