From a1596cdc37a9da9cca30f211b8baee62badd6ab0 Mon Sep 17 00:00:00 2001 From: Peter Foley Date: Thu, 5 Mar 2026 11:04:56 -0500 Subject: [PATCH] net/passt: Only kill passt if it wrote a pidfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Peter Foley Message-ID: <20260305-passt-v2-1-f0582198afc0@google.com> Signed-off-by: Philippe Mathieu-Daudé --- net/passt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/passt.c b/net/passt.c index 9ed811a514..b3d4b71314 100644 --- a/net/passt.c +++ b/net/passt.c @@ -102,7 +102,9 @@ static void net_passt_cleanup(NetClientState *nc) } #endif - kill(s->pid, SIGTERM); + if (s->pid > 0) { + kill(s->pid, SIGTERM); + } if (g_remove(s->pidfile) != 0) { warn_report("Failed to remove passt pidfile %s: %s", s->pidfile, strerror(errno));