net/passt: Only kill passt if it wrote a pidfile
Avoid killing qemu if passt failed before writing a pidfile. pid is initialized to 0, so calling pid in this scenario would kill the entire process group. Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Peter Foley <pefoley@google.com> Message-ID: <20260305-passt-v2-1-f0582198afc0@google.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Peter Foley committed
Mar 5, 2026 at 11:04 UTC
a1596cdc37a9da9cca30f211b8baee62badd6ab0
1 file changed
+3
-1
net/passt.c
+3
-1
@@ -102,7 +102,9 @@ static void net_passt_cleanup(NetClientState *nc)
102
}
103
#endif
104
105
- kill(s->pid, SIGTERM);
105
+ if (s->pid > 0) {
106
+ kill(s->pid, SIGTERM);
107
+ }
108
if (g_remove(s->pidfile) != 0) {
109
warn_report("Failed to remove passt pidfile %s: %s",
110
s->pidfile, strerror(errno));