xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-4.14 0/2] tools: two minor fixes for libxenhypfs
@ 2020-06-09 14:48 Juergen Gross
  2020-06-09 14:48 ` [PATCH for-4.14 1/2] tools: fix error path of xenhypfs_open() Juergen Gross
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Juergen Gross @ 2020-06-09 14:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Ian Jackson, Wei Liu, paul

Two fixes for libxenhypfs:

- xenhypfs terminating with segfault when hypervisor doesn't have
  hypfs support
- wrong error reporting in case for access errors with xenhypfs

Juergen Gross (2):
  tools: fix error path of xenhypfs_open()
  tools: fix setting of errno in xenhypfs_read_raw()

 tools/libs/hypfs/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.26.2



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH for-4.14 1/2] tools: fix error path of xenhypfs_open()
  2020-06-09 14:48 [PATCH for-4.14 0/2] tools: two minor fixes for libxenhypfs Juergen Gross
@ 2020-06-09 14:48 ` Juergen Gross
  2020-06-09 14:56   ` Paul Durrant
  2020-06-09 14:48 ` [PATCH for-4.14 2/2] tools: fix setting of errno in xenhypfs_read_raw() Juergen Gross
  2020-06-09 15:38 ` [PATCH for-4.14 0/2] tools: two minor fixes for libxenhypfs Wei Liu
  2 siblings, 1 reply; 6+ messages in thread
From: Juergen Gross @ 2020-06-09 14:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Andrew Cooper, Ian Jackson, Wei Liu, paul

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 <andrew.cooper3@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 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;
 
 err:
-    xtl_logger_destroy(fshdl->logger_tofree);
     xencall_close(fshdl->xcall);
+    xtl_logger_destroy(fshdl->logger_tofree);
     free(fshdl);
     return NULL;
 }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH for-4.14 2/2] tools: fix setting of errno in xenhypfs_read_raw()
  2020-06-09 14:48 [PATCH for-4.14 0/2] tools: two minor fixes for libxenhypfs Juergen Gross
  2020-06-09 14:48 ` [PATCH for-4.14 1/2] tools: fix error path of xenhypfs_open() Juergen Gross
@ 2020-06-09 14:48 ` Juergen Gross
  2020-06-09 15:02   ` Paul Durrant
  2020-06-09 15:38 ` [PATCH for-4.14 0/2] tools: two minor fixes for libxenhypfs Wei Liu
  2 siblings, 1 reply; 6+ messages in thread
From: Juergen Gross @ 2020-06-09 14:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Ian Jackson, George Dunlap, Wei Liu, paul

Setting of errno is wrong in xenhypfs_read_raw(), fix it.

Reported-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 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;
 
-        if (ret != ENOBUFS) {
-            errno = -ret;
+        if (errno != ENOBUFS)
             goto out;
-        }
     }
 
     content = malloc(entry->content_len);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH for-4.14 1/2] tools: fix error path of xenhypfs_open()
  2020-06-09 14:48 ` [PATCH for-4.14 1/2] tools: fix error path of xenhypfs_open() Juergen Gross
@ 2020-06-09 14:56   ` Paul Durrant
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Durrant @ 2020-06-09 14:56 UTC (permalink / raw)
  To: 'Juergen Gross', xen-devel
  Cc: 'Andrew Cooper', 'Ian Jackson', 'Wei Liu'

> -----Original Message-----
> From: Juergen Gross <jgross@suse.com>
> Sent: 09 June 2020 15:49
> To: xen-devel@lists.xenproject.org
> Cc: paul@xen.org; Juergen Gross <jgross@suse.com>; Ian Jackson <ian.jackson@eu.citrix.com>; Wei Liu
> <wl@xen.org>; Andrew Cooper <andrew.cooper3@citrix.com>
> Subject: [PATCH for-4.14 1/2] tools: fix error path of xenhypfs_open()
> 
> 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 <andrew.cooper3@citrix.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Paul Durrant <paul@xen.org>
Release-acked-by: Paul Durrant <paul@xen.org>

> ---
>  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;
> 
>  err:
> -    xtl_logger_destroy(fshdl->logger_tofree);
>      xencall_close(fshdl->xcall);
> +    xtl_logger_destroy(fshdl->logger_tofree);
>      free(fshdl);
>      return NULL;
>  }
> --
> 2.26.2




^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH for-4.14 2/2] tools: fix setting of errno in xenhypfs_read_raw()
  2020-06-09 14:48 ` [PATCH for-4.14 2/2] tools: fix setting of errno in xenhypfs_read_raw() Juergen Gross
@ 2020-06-09 15:02   ` Paul Durrant
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Durrant @ 2020-06-09 15:02 UTC (permalink / raw)
  To: 'Juergen Gross', xen-devel
  Cc: 'Ian Jackson', 'George Dunlap', 'Wei Liu'

> -----Original Message-----
> From: Juergen Gross <jgross@suse.com>
> Sent: 09 June 2020 15:49
> To: xen-devel@lists.xenproject.org
> Cc: paul@xen.org; Juergen Gross <jgross@suse.com>; Ian Jackson <ian.jackson@eu.citrix.com>; Wei Liu
> <wl@xen.org>; George Dunlap <george.dunlap@citrix.com>
> Subject: [PATCH for-4.14 2/2] tools: fix setting of errno in xenhypfs_read_raw()
> 
> Setting of errno is wrong in xenhypfs_read_raw(), fix it.
> 
> Reported-by: George Dunlap <george.dunlap@citrix.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Paul Durrant <paul@xen.org>
Release-acked-by: Paul Durrant <paul@xen.org>

> ---
>  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;
> 
> -        if (ret != ENOBUFS) {
> -            errno = -ret;
> +        if (errno != ENOBUFS)
>              goto out;
> -        }
>      }
> 
>      content = malloc(entry->content_len);
> --
> 2.26.2




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for-4.14 0/2] tools: two minor fixes for libxenhypfs
  2020-06-09 14:48 [PATCH for-4.14 0/2] tools: two minor fixes for libxenhypfs Juergen Gross
  2020-06-09 14:48 ` [PATCH for-4.14 1/2] tools: fix error path of xenhypfs_open() Juergen Gross
  2020-06-09 14:48 ` [PATCH for-4.14 2/2] tools: fix setting of errno in xenhypfs_read_raw() Juergen Gross
@ 2020-06-09 15:38 ` Wei Liu
  2 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2020-06-09 15:38 UTC (permalink / raw)
  To: Juergen Gross; +Cc: xen-devel, Ian Jackson, Wei Liu, paul

On Tue, Jun 09, 2020 at 04:48:48PM +0200, Juergen Gross wrote:
> Two fixes for libxenhypfs:
> 
> - xenhypfs terminating with segfault when hypervisor doesn't have
>   hypfs support
> - wrong error reporting in case for access errors with xenhypfs
> 
> Juergen Gross (2):
>   tools: fix error path of xenhypfs_open()
>   tools: fix setting of errno in xenhypfs_read_raw()

Applied. I also added Fixes tags to them.

Wei.

> 
>  tools/libs/hypfs/core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> -- 
> 2.26.2
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-09 15:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 14:48 [PATCH for-4.14 0/2] tools: two minor fixes for libxenhypfs Juergen Gross
2020-06-09 14:48 ` [PATCH for-4.14 1/2] tools: fix error path of xenhypfs_open() Juergen Gross
2020-06-09 14:56   ` Paul Durrant
2020-06-09 14:48 ` [PATCH for-4.14 2/2] tools: fix setting of errno in xenhypfs_read_raw() Juergen Gross
2020-06-09 15:02   ` Paul Durrant
2020-06-09 15:38 ` [PATCH for-4.14 0/2] tools: two minor fixes for libxenhypfs Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).