From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF895C2BA2B for ; Thu, 9 Apr 2020 14:34:34 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA5DF20771 for ; Thu, 9 Apr 2020 14:34:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA5DF20771 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jMYG5-0005Ct-4h; Thu, 09 Apr 2020 14:34:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jMYG4-0005Ck-6w for xen-devel@lists.xenproject.org; Thu, 09 Apr 2020 14:34:20 +0000 X-Inumbo-ID: 2f11eb44-7a6f-11ea-82d8-12813bfff9fa Received: from hera.aquilenet.fr (unknown [185.233.100.1]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2f11eb44-7a6f-11ea-82d8-12813bfff9fa; Thu, 09 Apr 2020 14:34:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 90E5A2FEF; Thu, 9 Apr 2020 16:34:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CPzKiQ9A8oKS; Thu, 9 Apr 2020 16:34:12 +0200 (CEST) Received: from function.home (unknown [IPv6:2a01:cb19:956:1b00:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3875C2FBC; Thu, 9 Apr 2020 16:34:12 +0200 (CEST) Received: from samy by function.home with local (Exim 4.93) (envelope-from ) id 1jMYFv-001zXk-Bz; Thu, 09 Apr 2020 16:34:11 +0200 Date: Thu, 9 Apr 2020 16:34:11 +0200 From: Samuel Thibault To: Juergen Gross Subject: Re: [PATCH 2/3] mini-os: fix double free() in xenbus Message-ID: <20200409143411.xa6ar7do64y7mpzf@function> Mail-Followup-To: Samuel Thibault , Juergen Gross , minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org, wl@xen.org References: <20200409141240.28876-1-jgross@suse.com> <20200409141240.28876-3-jgross@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200409141240.28876-3-jgross@suse.com> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org, wl@xen.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Juergen Gross, le jeu. 09 avril 2020 16:12:39 +0200, a ecrit: > Commit 973ad0c4de1b48 ("Save/Restore Support: Add suspend/restore > support for xenbus") introduced a double free of some memory and leaked > another memory allocation. > > Fix those. > > Coverity-ID: 1433640 > Fixes: 973ad0c4de1b48 ("Save/Restore Support: Add suspend/restore support for xenbus") > Signed-off-by: Juergen Gross Reviewed-by: Samuel Thibault > --- > xenbus/xenbus.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/xenbus/xenbus.c b/xenbus/xenbus.c > index d72dc3a..b12cef7 100644 > --- a/xenbus/xenbus.c > +++ b/xenbus/xenbus.c > @@ -413,9 +413,11 @@ void resume_xenbus(int canceled) > > rep = xenbus_msg_reply(XS_WATCH, XBT_NIL, req, ARRAY_SIZE(req)); > msg = errmsg(rep); > - if (msg) > + if (msg) { > xprintk("error on XS_WATCH: %s\n", msg); > - free(rep); > + free(msg); > + } else > + free(rep); > } > } > > -- > 2.16.4 >