* [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze
@ 2018-07-16 21:44 Michael Roth
2018-07-17 9:54 ` Peter Maydell
0 siblings, 1 reply; 6+ messages in thread
From: Michael Roth @ 2018-07-16 21:44 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
The following changes since commit 102ad0a80f5110483efd06877c29c4236be267f9:
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-07-16' into staging (2018-07-16 15:34:38 +0100)
are available in the git repository at:
git://github.com/mdroth/qemu.git tags/qga-pull-2018-07-16-tag
for you to fetch changes up to d9c745c1768727aadd77e352c85114bc61e67bd4:
qga: fix file descriptor leak (2018-07-16 15:05:58 -0500)
----------------------------------------------------------------
qemu-ga patch queue for hard-freeze
* fix file descriptor leak in suspend command
* fix leak in guest-get-fsinfo
----------------------------------------------------------------
Marc-André Lureau (1):
qga: fix 'driver' leak in guest-get-fsinfo
Paolo Bonzini (1):
qga: fix file descriptor leak
qga/commands-posix.c | 2 ++
1 file changed, 2 insertions(+)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze
2018-07-16 21:44 Michael Roth
@ 2018-07-17 9:54 ` Peter Maydell
0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2018-07-17 9:54 UTC (permalink / raw)
To: Michael Roth; +Cc: QEMU Developers
On 16 July 2018 at 22:44, Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> The following changes since commit 102ad0a80f5110483efd06877c29c4236be267f9:
>
> Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-07-16' into staging (2018-07-16 15:34:38 +0100)
>
> are available in the git repository at:
>
> git://github.com/mdroth/qemu.git tags/qga-pull-2018-07-16-tag
>
> for you to fetch changes up to d9c745c1768727aadd77e352c85114bc61e67bd4:
>
> qga: fix file descriptor leak (2018-07-16 15:05:58 -0500)
>
> ----------------------------------------------------------------
> qemu-ga patch queue for hard-freeze
>
> * fix file descriptor leak in suspend command
> * fix leak in guest-get-fsinfo
>
> ----------------------------------------------------------------
> Marc-André Lureau (1):
> qga: fix 'driver' leak in guest-get-fsinfo
>
> Paolo Bonzini (1):
> qga: fix file descriptor leak
>
> qga/commands-posix.c | 2 ++
> 1 file changed, 2 insertions(+)
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze
@ 2018-07-24 0:01 Michael Roth
2018-07-24 0:01 ` [Qemu-devel] [PULL for-3.0 1/2] qga-win: Handle fstrim for OSes lower than Win8 Michael Roth
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Michael Roth @ 2018-07-24 0:01 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
The following changes since commit 4eecc2e212bae7308d8582d99f665dfc253c9dda:
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180723' into staging (2018-07-23 19:24:05 +0100)
are available in the Git repository at:
git://github.com/mdroth/qemu.git tags/qga-pull-2018-07-23-tag
for you to fetch changes up to ae7da1e5f658ea21d96e565514de20ff2cf24fa1:
qga: process_event() simplification and leak fix (2018-07-23 18:54:26 -0500)
----------------------------------------------------------------
qemu-ga patch queue for hard-freeze
* fix leak in qga main loop error path
* better error reporting when Windows version doesn't support fstrim
----------------------------------------------------------------
Marc-André Lureau (1):
qga: process_event() simplification and leak fix
Sameeh Jubran (1):
qga-win: Handle fstrim for OSes lower than Win8
qga/commands-win32.c | 13 +++++++++++++
qga/main.c | 54 ++++++++++++++++++++++++++--------------------------
2 files changed, 40 insertions(+), 27 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL for-3.0 1/2] qga-win: Handle fstrim for OSes lower than Win8
2018-07-24 0:01 [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze Michael Roth
@ 2018-07-24 0:01 ` Michael Roth
2018-07-24 0:01 ` [Qemu-devel] [PULL for-3.0 2/2] qga: process_event() simplification and leak fix Michael Roth
2018-07-24 12:29 ` [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Michael Roth @ 2018-07-24 0:01 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Sameeh Jubran
From: Sameeh Jubran <sjubran@redhat.com>
The defrag.exe tool which is used for executing the fstrim command
on Windows doesn't support retrim for OSes lower than Win8. This
commit handles this case and returns a suitable error.
Output of fstrim before this commit:
{"execute":"guest-fstrim"}
{"return": {"paths": [{"path": "C:\\", "error": "An invalid command line option
was specified. (0x89000008)"}, {"path": "F:\\", "error": "An invalid command
line option was specified. (0x89000008)"}, {"path": "S:\\", "error": "An
invalid command line option was specified. (0x89000008)"}]}}
Reported on:
https://bugzilla.redhat.com/show_bug.cgi?id=1594113
Signed-off-by: Sameeh Jubran <sjubran@redhat.com>
* use alternative version query code proposed by Sameeh
* fix up version check logic
* avoid CamelCase variable names when possible
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
qga/commands-win32.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 318d760a74..98d9735389 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -865,6 +865,19 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
GuestFilesystemTrimResponse *resp;
HANDLE handle;
WCHAR guid[MAX_PATH] = L"";
+ OSVERSIONINFO osvi;
+ BOOL win8_or_later;
+
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&osvi);
+ win8_or_later = (osvi.dwMajorVersion > 6 ||
+ ((osvi.dwMajorVersion == 6) &&
+ (osvi.dwMinorVersion >= 2)));
+ if (!win8_or_later) {
+ error_setg(errp, "fstrim is only supported for Win8+");
+ return NULL;
+ }
handle = FindFirstVolumeW(guid, ARRAYSIZE(guid));
if (handle == INVALID_HANDLE_VALUE) {
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL for-3.0 2/2] qga: process_event() simplification and leak fix
2018-07-24 0:01 [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze Michael Roth
2018-07-24 0:01 ` [Qemu-devel] [PULL for-3.0 1/2] qga-win: Handle fstrim for OSes lower than Win8 Michael Roth
@ 2018-07-24 0:01 ` Michael Roth
2018-07-24 12:29 ` [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Michael Roth @ 2018-07-24 0:01 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Marc-André Lureau, qemu-stable
From: Marc-André Lureau <marcandre.lureau@redhat.com>
json_parser_parse_err() may return something else than a QDict, in
which case we loose the object. Let's keep track of the original
object to avoid leaks.
When an error occurs, "qdict" contains the response, but we still
check the "execute" key there. Untangle a bit this code, by having a
clear error path.
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
qga/main.c | 54 +++++++++++++++++++++++++++---------------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/qga/main.c b/qga/main.c
index 537cc0e162..87372d40ef 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -600,42 +600,42 @@ static void process_command(GAState *s, QDict *req)
static void process_event(JSONMessageParser *parser, GQueue *tokens)
{
GAState *s = container_of(parser, GAState, parser);
- QDict *qdict;
+ QObject *obj;
+ QDict *req, *rsp;
Error *err = NULL;
int ret;
g_assert(s && parser);
g_debug("process_event: called");
- qdict = qobject_to(QDict, json_parser_parse_err(tokens, NULL, &err));
- if (err || !qdict) {
- qobject_unref(qdict);
- if (!err) {
- g_warning("failed to parse event: unknown error");
- error_setg(&err, QERR_JSON_PARSING);
- } else {
- g_warning("failed to parse event: %s", error_get_pretty(err));
- }
- qdict = qmp_error_response(err);
+ obj = json_parser_parse_err(tokens, NULL, &err);
+ if (err) {
+ goto err;
}
-
- /* handle host->guest commands */
- if (qdict_haskey(qdict, "execute")) {
- process_command(s, qdict);
- } else {
- if (!qdict_haskey(qdict, "error")) {
- qobject_unref(qdict);
- g_warning("unrecognized payload format");
- error_setg(&err, QERR_UNSUPPORTED);
- qdict = qmp_error_response(err);
- }
- ret = send_response(s, qdict);
- if (ret < 0) {
- g_warning("error sending error response: %s", strerror(-ret));
- }
+ req = qobject_to(QDict, obj);
+ if (!req) {
+ error_setg(&err, QERR_JSON_PARSING);
+ goto err;
+ }
+ if (!qdict_haskey(req, "execute")) {
+ g_warning("unrecognized payload format");
+ error_setg(&err, QERR_UNSUPPORTED);
+ goto err;
}
- qobject_unref(qdict);
+ process_command(s, req);
+ qobject_unref(obj);
+ return;
+
+err:
+ g_warning("failed to parse event: %s", error_get_pretty(err));
+ rsp = qmp_error_response(err);
+ ret = send_response(s, rsp);
+ if (ret < 0) {
+ g_warning("error sending error response: %s", strerror(-ret));
+ }
+ qobject_unref(rsp);
+ qobject_unref(obj);
}
/* false return signals GAChannel to close the current client connection */
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze
2018-07-24 0:01 [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze Michael Roth
2018-07-24 0:01 ` [Qemu-devel] [PULL for-3.0 1/2] qga-win: Handle fstrim for OSes lower than Win8 Michael Roth
2018-07-24 0:01 ` [Qemu-devel] [PULL for-3.0 2/2] qga: process_event() simplification and leak fix Michael Roth
@ 2018-07-24 12:29 ` Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2018-07-24 12:29 UTC (permalink / raw)
To: Michael Roth; +Cc: QEMU Developers
On 24 July 2018 at 01:01, Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> The following changes since commit 4eecc2e212bae7308d8582d99f665dfc253c9dda:
>
> Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180723' into staging (2018-07-23 19:24:05 +0100)
>
> are available in the Git repository at:
>
> git://github.com/mdroth/qemu.git tags/qga-pull-2018-07-23-tag
>
> for you to fetch changes up to ae7da1e5f658ea21d96e565514de20ff2cf24fa1:
>
> qga: process_event() simplification and leak fix (2018-07-23 18:54:26 -0500)
>
> ----------------------------------------------------------------
> qemu-ga patch queue for hard-freeze
>
> * fix leak in qga main loop error path
> * better error reporting when Windows version doesn't support fstrim
>
> ----------------------------------------------------------------
> Marc-André Lureau (1):
> qga: process_event() simplification and leak fix
>
> Sameeh Jubran (1):
> qga-win: Handle fstrim for OSes lower than Win8
>
> qga/commands-win32.c | 13 +++++++++++++
> qga/main.c | 54 ++++++++++++++++++++++++++--------------------------
> 2 files changed, 40 insertions(+), 27 deletions(-)
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-24 12:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-24 0:01 [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze Michael Roth
2018-07-24 0:01 ` [Qemu-devel] [PULL for-3.0 1/2] qga-win: Handle fstrim for OSes lower than Win8 Michael Roth
2018-07-24 0:01 ` [Qemu-devel] [PULL for-3.0 2/2] qga: process_event() simplification and leak fix Michael Roth
2018-07-24 12:29 ` [Qemu-devel] [PULL for-3.0 0/2] qemu-ga patch queue for hard-freeze Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2018-07-16 21:44 Michael Roth
2018-07-17 9:54 ` Peter Maydell
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).