From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Paul Durrant <paul.durrant@citrix.com>, xen-devel@lists.xenproject.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH] xenforeignmemory: work around bug in older privcmd
Date: Tue, 28 Aug 2018 15:12:32 +0100 [thread overview]
Message-ID: <fcd947b7-844d-2ddf-71ee-45dfd6cf4566@citrix.com> (raw)
In-Reply-To: <20180824121626.27261-1-paul.durrant@citrix.com>
On 24/08/18 13:16, Paul Durrant wrote:
> diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
> index 3686cf41e0..0368aa09f4 100644
> --- a/tools/libs/foreignmemory/linux.c
> +++ b/tools/libs/foreignmemory/linux.c
> @@ -53,6 +53,23 @@ int osdep_xenforeignmemory_open(xenforeignmemory_handle *fmem)
> return -1;
> }
>
> + /*
> + * Older versions of privcmd return -EINVAL for unimplemented ioctls
> + * so we need to probe for the errno to use rather than just using
> + * the conventional ENOTTY.
> + */
> + if ( ioctl(fd, IOCTL_PRIVCMD_UNIMPLEMENTED, NULL) >= 0 )
> + {
> + xtl_log(fmem->logger, XTL_ERROR, -1, "xenforeignmemory",
> + "privcmd ioctl should not be implemented");
This error path leaks fd.
~Andrew
> + return -1;
> + }
> + else
> + {
> + fmem->unimpl_errno = errno;
> + errno = 0;
> + }
> +
> fmem->fd = fd;
> return 0;
> }
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-08-28 14:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-24 12:16 [PATCH] xenforeignmemory: work around bug in older privcmd Paul Durrant
2018-08-24 13:24 ` Wei Liu
2018-08-24 15:16 ` Ian Jackson
2018-08-27 9:04 ` Jan Beulich
2018-08-27 9:11 ` Wei Liu
2018-08-28 14:12 ` Andrew Cooper [this message]
2018-08-28 14:20 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fcd947b7-844d-2ddf-71ee-45dfd6cf4566@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=paul.durrant@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).