From nobody Tue Feb 10 03:38:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1614274952; cv=none; d=zohomail.com; s=zohoarc; b=OGoY/tVylu9cULkAK+Jb9sXWYCgovFqS29wfQZ8X96gB3/c6KE+4K/SreK5mYceH5crs+I+DYZloRZhY2PF3wSvXPJiHMjwm/Un8Ae3tfStsY/Bv2bSK68rZWGpTJGYgq0M0etXSD5F5xitihr7MXGc4QDYk8OWmR9abEfEPqxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614274952; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=MOM7smBMP9BCXNrEE1hf8/uoWjibhwZ1Ud0ejevMQus=; b=kjPLU2nMrTlN2FqvqPcvQn2ci1cZ1HiAsrnOJWES+cgQ+Ezr4OmwtfRdD9VhoCTUsVYihEdkBOm+S+gwWqHL9Rs4bd0E/CxBbK1u3cAPe7/xYBcNhVpDwyMjt8rCqJG71u3KTWQUjls4dZ/ESo0MS4WA8Gjzfo/CqAq9vS7asho= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1614274952898169.20057857975416; Thu, 25 Feb 2021 09:42:32 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.89894.169827 (Exim 4.92) (envelope-from ) id 1lFKeZ-0006H4-Dy; Thu, 25 Feb 2021 17:42:19 +0000 Received: by outflank-mailman (output) from mailman id 89894.169827; Thu, 25 Feb 2021 17:42:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFKeZ-0006Gu-9z; Thu, 25 Feb 2021 17:42:19 +0000 Received: by outflank-mailman (input) for mailman id 89894; Thu, 25 Feb 2021 17:42:17 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFKeX-0006Eh-Lv for xen-devel@lists.xenproject.org; Thu, 25 Feb 2021 17:42:17 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFKeW-0005r7-OD; Thu, 25 Feb 2021 17:42:16 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFKeW-00032g-FC; Thu, 25 Feb 2021 17:42:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=MOM7smBMP9BCXNrEE1hf8/uoWjibhwZ1Ud0ejevMQus=; b=KDNoJwOGHmFC6HUQafwmQtJ5i XDPpKCkfQVLho8V22Sg9WziAsyJSl7e3NsLAAAI97Z9jSnBWKKbhSdFJtPCRolByzOk9IccxFbe6Y xWgZ1G5RrcXTIjyNJck3YtCec6T2w7Ic4ndI9qwc9hFeUyCZ4rEhh5Mh/rT3ewGZeu1xY=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: raphning@amazon.co.uk, iwj@xenproject.org, Julien Grall , Wei Liu , Juergen Gross Subject: [PATCH for-4.15 4/5] tools/xenstore-control: Don't leak buf in live_update_start() Date: Thu, 25 Feb 2021 17:41:30 +0000 Message-Id: <20210225174131.10115-5-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210225174131.10115-1-julien@xen.org> References: <20210225174131.10115-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall All the error paths but one will free buf. Cover the remaining path so buf can't be leaked. This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. Fixes: 7f97193e6aa8 ("tools/xenstore: add live update command to xenstore-c= ontrol") Signed-off-by: Julien Grall Reviewed-by: Juergen Gross --- tools/xenstore/xenstore_control.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/xenstore/xenstore_control.c b/tools/xenstore/xenstore_co= ntrol.c index f6f4626c0656..548363ee7094 100644 --- a/tools/xenstore/xenstore_control.c +++ b/tools/xenstore/xenstore_control.c @@ -44,8 +44,10 @@ static int live_update_start(struct xs_handle *xsh, bool= force, unsigned int to) return 1; =20 ret =3D strdup("BUSY"); - if (!ret) + if (!ret) { + free(buf); return 1; + } =20 for (time_start =3D time(NULL); time(NULL) - time_start < to;) { free(ret); --=20 2.17.1