From nobody Wed May 8 00:49:16 2024 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; 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=1591714153; cv=none; d=zohomail.com; s=zohoarc; b=gEWgPm73qooTrjGk0v600v6qkbuCPhGdapyrL6w8qig6xO48EGToJfmvbmWHBoSqmy9zbjJlRB+4zAgipYu6i2W0QMT9B3GXd014i3Ulpsz3R6v2VKVNJ9qW2MExlErUEXrNKZXSOoG+wjUrWoeUE31f+cH38Cd+RCEEK8DQezY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591714153; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4R1pk3ksqF30jD+tnpX2U0HHy41kJYPy+33kH8rrt2g=; b=cuu/Ld7QePTxyTzGP2DKJ0/MMErJu0KDPjohN5OaYLxUi7wi1TYxaQSsSTZ8PLhO4aaPeFHFj6LjP98U3uRiCnJ7zQ078BjthxpqnRCL238JVZtDZ0DTA2Tf28kwfEz9Zhzan5VKlqQks7oECUqieWtorn8MsrmeGFAcKSSR2fQ= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1591714153056981.1136839888027; Tue, 9 Jun 2020 07:49:13 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jifYi-0007aF-HM; Tue, 09 Jun 2020 14:49:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jifYi-0007YS-5U for xen-devel@lists.xenproject.org; Tue, 09 Jun 2020 14:49:00 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 56d787b2-aa60-11ea-b7bb-bc764e2007e4; Tue, 09 Jun 2020 14:48:54 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DD42FAD85; Tue, 9 Jun 2020 14:48:56 +0000 (UTC) X-Inumbo-ID: 56d787b2-aa60-11ea-b7bb-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Subject: [PATCH for-4.14 1/2] tools: fix error path of xenhypfs_open() Date: Tue, 9 Jun 2020 16:48:49 +0200 Message-Id: <20200609144850.28619-2-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200609144850.28619-1-jgross@suse.com> References: <20200609144850.28619-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Andrew Cooper , Ian Jackson , Wei Liu , paul@xen.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Type: text/plain; charset="utf-8" In case of an error in xenhypfs_open() the error path will cause a segmentation fault due to a wrong sequence of closing calls. Reported-by: Andrew Cooper Signed-off-by: Juergen Gross Reviewed-by: Paul Durrant --- tools/libs/hypfs/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c index c91e165705..fc23b02586 100644 --- a/tools/libs/hypfs/core.c +++ b/tools/libs/hypfs/core.c @@ -74,8 +74,8 @@ xenhypfs_handle *xenhypfs_open(xentoollog_logger *logger, return fshdl; =20 err: - xtl_logger_destroy(fshdl->logger_tofree); xencall_close(fshdl->xcall); + xtl_logger_destroy(fshdl->logger_tofree); free(fshdl); return NULL; } --=20 2.26.2 From nobody Wed May 8 00:49:16 2024 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; 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=1591714153; cv=none; d=zohomail.com; s=zohoarc; b=mJgw/7S9YQkjzFqdJydPgX9xYTcPGfaIsNVrsTimHDInaP1ISA5r17GqD2MVZH+GOOOhI0liei87Pgvo3Jw+BjBWMt2eI8NOEObthnUWgHjpdHGV5uaGAp1dEvW5UQ9OVD9thxBPWqECaTuOsUkYQ4JRhEoVXxThBJB1XcJcDBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591714153; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KCabhxPzDwJ5WYJUTkL+8E831X6U188tZEuyObngD9Y=; b=DiMtLXRzQU0ouVcrciPQUqCR48qNrE4SGHcizvkgV0ij/n/chCXBv+2rSZj58wwLewfMsGR7okX7Y/IbCz8fuAajpEu3lC0vEZ01nTJmZxIRO2SIGwrAzhsy5WpazSE0e7QWxcDTsdvWNenLdKJFmD5y/FAo3KxBgYvj1sv1jc4= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1591714153400159.41404188490503; Tue, 9 Jun 2020 07:49:13 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jifYf-0007Yi-97; Tue, 09 Jun 2020 14:48:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jifYd-0007YS-B2 for xen-devel@lists.xenproject.org; Tue, 09 Jun 2020 14:48:55 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 56e693a6-aa60-11ea-bca7-bc764e2007e4; Tue, 09 Jun 2020 14:48:54 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 17553ADD3; Tue, 9 Jun 2020 14:48:57 +0000 (UTC) X-Inumbo-ID: 56e693a6-aa60-11ea-bca7-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Subject: [PATCH for-4.14 2/2] tools: fix setting of errno in xenhypfs_read_raw() Date: Tue, 9 Jun 2020 16:48:50 +0200 Message-Id: <20200609144850.28619-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200609144850.28619-1-jgross@suse.com> References: <20200609144850.28619-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Ian Jackson , George Dunlap , Wei Liu , paul@xen.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Type: text/plain; charset="utf-8" Setting of errno is wrong in xenhypfs_read_raw(), fix it. Reported-by: George Dunlap Signed-off-by: Juergen Gross Reviewed-by: Paul Durrant --- tools/libs/hypfs/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c index fc23b02586..f94c5ea1e2 100644 --- a/tools/libs/hypfs/core.c +++ b/tools/libs/hypfs/core.c @@ -241,10 +241,8 @@ void *xenhypfs_read_raw(xenhypfs_handle *fshdl, const = char *path, if (!ret) break; =20 - if (ret !=3D ENOBUFS) { - errno =3D -ret; + if (errno !=3D ENOBUFS) goto out; - } } =20 content =3D malloc(entry->content_len); --=20 2.26.2