From nobody Sat Oct 4 20:35:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1546528651507296.05824292153284; Thu, 3 Jan 2019 07:17:31 -0800 (PST) Received: from localhost ([127.0.0.1]:55266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf4kU-0002as-CT for importer@patchew.org; Thu, 03 Jan 2019 10:17:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf22C-0005FW-F2 for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gf229-0004CX-9a for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:36 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:33389) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gf228-0004BD-Q5 for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:33 -0500 Received: by mail-wm1-x341.google.com with SMTP id r24so34706911wmh.0 for ; Thu, 03 Jan 2019 04:23:32 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id t76sm72325798wme.33.2019.01.03.04.23.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Jan 2019 04:23:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4y8IX/PTbaSNnmt6YfKxNBI0mWnpg3gIlKzBnlx4MoI=; b=yTnSZA4pMyI9ms3gKi137P1tjSwq2XepoEYZgDvgKQ3MTs7lHkIXN6W/WyP8LuCHsA B++kbOEsoRJZrCO4HjTLpvcNY2V+cx7oGTps2M9mPuUk03KfbTMwA+K3MVFFwivrttTQ BYYcFPOhuKHRyb0fdzGFp+FkC5qfl/Ycm8g3QV5eobRW31vZmkgTmE+mL3ob7ElRno/x 6xcenwloqod/1/+2EELVDMGGxYdnBWT2mYV5b/7gDXy4cIOIhtVwm5juqlG3nrdT82If xlgjwuecQj+SLhLZlfML+rm8YF3MMMt9EXE5AX6DwAXDjQJ6Wr/AphPc5JlolaEBADdW 4sSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4y8IX/PTbaSNnmt6YfKxNBI0mWnpg3gIlKzBnlx4MoI=; b=bhS6CaSx1gN6alIkg/K0FShSLvP4RIgkkeRsNod7a6ATtHcKcknpIQfN6kdnRV6dSD YPDT8JggiBiTwnbDntYvUs0zGlsXtQpGUGwVwbSDk5S5JjZ272K4FE5cC/KR8RtBQSkl xooDulOKYYQsaIC0J5UdpsRtFf3WOD1yby9vAncByroiqmTxDeFFIPX7vayfR/miYYpR 3QDHWDe4ogo/qZnIlNJVwwtDkH6R1P8YHFgAnsg99jlnGsNVYZuccPhsiXKPwAWI2Sl5 B7PCWgy3MKS4J1fPlmumbzvgfHtJCb29c17AOwtbjxghB3tcs95ubhxGDF2QJPlS9NdZ jBZw== X-Gm-Message-State: AA+aEWaE0vtUOLaX2zn3qUaNhAEeK0nsryGb2yRLcQIXIRow909DAZUu Hqbc8DHgElyh1xuphA/HcNUlsg/jYv24rg== X-Google-Smtp-Source: ALg8bN7OEIyGJI1OPbILL7GzuR0ytmev+qnPdCGs2uknqhQ7mnWOcladcv4lIKln9xFbTOGqIcKTlg== X-Received: by 2002:a1c:aad2:: with SMTP id t201mr36668166wme.148.1546518210446; Thu, 03 Jan 2019 04:23:30 -0800 (PST) From: Basil Salman To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 3 Jan 2019 14:23:20 +0200 Message-Id: <20190103122323.1273034-2-basil@daynix.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190103122323.1273034-1-basil@daynix.com> References: <20190103122323.1273034-1-basil@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 X-Mailman-Approved-At: Thu, 03 Jan 2019 10:10:24 -0500 Subject: [Qemu-devel] [PATCH 1/4] qga-win: prevent crash when executing guest-file-read with large count X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer , Bishara AbuHattoum Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" BZ: #1594054 guest-file-read command is currently implelmented to read from a file handle count number of bytes. when executed with a very large count nu= mber qemu-ga crashes. after some digging turns out that qemu-ga crashes after trying to allocate a buffer large enough to save the data read in it, the buffer was allocated= using g_malloc0 which is not fail safe, and results a crash in case of failure. g_malloc0 was replaced with g_try_malloc0() which returns NULL on failure, A check was added for that case in order to prevent qemu-ga from crashing and to send a response to the qemu-ga client accordingly. Signed-off-by: Basil Salman --- qga/commands-win32.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 62e1b51dfe..4260faa573 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -345,7 +345,13 @@ GuestFileRead *qmp_guest_file_read(int64_t handle, boo= l has_count, } =20 fh =3D gfh->fh; - buf =3D g_malloc0(count+1); + buf =3D g_try_malloc0(count + 1); + if (!buf) { + error_setg(errp, + "failed to allocate sufficient memory" + "to complete the requested service"); + return read_data; + } is_ok =3D ReadFile(fh, buf, count, &read_count, NULL); if (!is_ok) { error_setg_win32(errp, GetLastError(), "failed to read file"); --=20 2.17.2 From nobody Sat Oct 4 20:35:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1546528570909969.1907395570807; Thu, 3 Jan 2019 07:16:10 -0800 (PST) Received: from localhost ([127.0.0.1]:55240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf4jB-00017f-PU for importer@patchew.org; Thu, 03 Jan 2019 10:16:09 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf22C-0005FV-Eq for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gf229-0004Cd-9d for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:36 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:40604) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gf228-0004Bi-S8 for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:33 -0500 Received: by mail-wm1-x343.google.com with SMTP id f188so30104076wmf.5 for ; Thu, 03 Jan 2019 04:23:32 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id t76sm72325798wme.33.2019.01.03.04.23.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Jan 2019 04:23:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BeznIJQALwc/PDSYm8fp48HdMnQYcXjdvDBCvgmRVC4=; b=R64hqXq7EPO4ElT//qZRDirEJVDOi/RBV3hJZMFnT0Sv3WbQmcfuHjU1dh5HxbzXvA YJ7IifmTU3kYAkF/CfkRpId0AgDAsiBGFIfvFaHpYTodSzdKbp3XB3DnP6sv72pBPXd9 ExBZ6kzzmlGRVy0BG3d7QBCFWaYtDtXhzBInfCbjyr4aTyCWDM/ts1Pnq5brd4lfDUGz x80uCinf6+ETJ6FlW5JLQh0dgp/MLp94OCe40hkc4A2GT5j0Y1D5D9ovYNNtZ0TF1/Nw o8r/D8Afl56l3MThyvO0AUCfDN3rWR7KsY6bXMcJut3wn1Cl1kC6ybPVMxMizOjk1l94 mKyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BeznIJQALwc/PDSYm8fp48HdMnQYcXjdvDBCvgmRVC4=; b=Lb5AoQcO4eSSNeeYXV8l6AhM9XeNuA61cr0InO+5n5i53iGk4JPCLZc42alPcBprzX n1srUxlYFA6LnBrvnBAiYzRHlkh7VCSTPprt3emIVhFQdhm2COjh/UmUzaxTa3JWMJ4O HrzVdb0yn8NElOe0AV3Ts3whGbJn4iI0KeP7sDXIn9y4gMZIgVjKXkjsikuKxH4gGl2r ox+GSEm1ggcM/03zNgEYAI3Q8Hyvza0Q/cHAlfN7TQALRCT2AfkGgl/XeAIJF6x82LQH UvbPwTvLRjgAlQd6qwGfJYXlh9qHM2sM8C9ShSqZQ5H19wzqXlF+Q7FYcloYg2JH0lHD h1qw== X-Gm-Message-State: AA+aEWYyh4Y9/YI5qEPzDGASYcf+9m2tm+NEUiZo1LM94kU5aFGvMRnw 7GEAd1hwgvS7EpcDFPNH8maXpYRt3u0tLQ== X-Google-Smtp-Source: ALg8bN4NJFaJ2mMsLNr87QohZBhHeT9AB0gRxmFLkN7yI8Z2zEo/sPOCsB1lBGLQu/NwnQgDTeReZw== X-Received: by 2002:a1c:e913:: with SMTP id q19mr39260102wmc.55.1546518211648; Thu, 03 Jan 2019 04:23:31 -0800 (PST) From: Basil Salman To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 3 Jan 2019 14:23:21 +0200 Message-Id: <20190103122323.1273034-3-basil@daynix.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190103122323.1273034-1-basil@daynix.com> References: <20190103122323.1273034-1-basil@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 X-Mailman-Approved-At: Thu, 03 Jan 2019 10:10:24 -0500 Subject: [Qemu-devel] [PATCH 2/4] qga: fix send_response error handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer , Bishara AbuHattoum Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Sometimes qemu-ga fails to send a response to client due to memory allocati= on issues due to a large response message, this can be experienced while trying to read large number of bytes using QMP command guest-file-read. Added a check to send an error response to qemu-ga client in such cases. Signed-off-by: Basil Salman --- qga/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/qga/main.c b/qga/main.c index 87a0711c14..964275c40c 100644 --- a/qga/main.c +++ b/qga/main.c @@ -561,6 +561,8 @@ static void process_command(GAState *s, QDict *req) { QDict *rsp; int ret; + QDict *ersp; + Error *err =3D NULL; =20 g_assert(req); g_debug("processing command"); @@ -569,9 +571,20 @@ static void process_command(GAState *s, QDict *req) ret =3D send_response(s, rsp); if (ret < 0) { g_warning("error sending response: %s", strerror(-ret)); + goto err; } qobject_unref(rsp); } + return; +err: + error_setg(&err, "Insufficient system resources exist to " + "complete the requested service"); + ersp =3D qmp_error_response(err); + ret =3D send_response(s, ersp); + if (ret < 0) { + g_warning("error sending error response: %s", strerror(-ret)); + } + qobject_unref(ersp); } =20 /* handle requests/control events coming in over the channel */ --=20 2.17.2 From nobody Sat Oct 4 20:35:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1546528327877520.5433844671467; Thu, 3 Jan 2019 07:12:07 -0800 (PST) Received: from localhost ([127.0.0.1]:55198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf4fG-0004op-Lo for importer@patchew.org; Thu, 03 Jan 2019 10:12:06 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf22C-0005FY-F5 for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gf22B-0004Dl-0V for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:36 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:46362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gf22A-0004Co-R1 for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:34 -0500 Received: by mail-wr1-x443.google.com with SMTP id l9so33350988wrt.13 for ; Thu, 03 Jan 2019 04:23:33 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id t76sm72325798wme.33.2019.01.03.04.23.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Jan 2019 04:23:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YmXW/SP9doq5sjoE7E/52vrDte/Mf5r4HqcJtOH7zn4=; b=ecNhuV0Y7Gu962o1EjsVaOrLQCEebe8X+xis2iImTuPWclj8fxmRtex3NCfJdbEa5W oTrPLnf/yndqp9GS5OdHGTMyfTXGSrW6ITID0M8LqnnbYBj4yFIsEJUUKlfVg9aFhi9F azl9NmylU8GCNw5Pe9N14UC6hKU2a7Suvr0LPwDjucJr0TH+LNfLjTp6pjeHo+UaoETU 2OiZuG/xM7fX394xd5wsGjov+w5MqVaUfJUeglLugxll2F+AgKffDqMkhJNkMTGYSFq8 9ZywUCF0KjWvkXRKVhXrHTmtMDtuhZ+ODKfmJqp/fFbN1dydq3xuI+oZ+qH3VP++0ybJ Vaxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YmXW/SP9doq5sjoE7E/52vrDte/Mf5r4HqcJtOH7zn4=; b=KmehAcYHRJlxqo3Jx0MZ0dT/rGJlqTFayuwQxKPWGkSBN1/ut5IFyvGwzYmNBPRs7B s8E5N8GPfk5yLR5mXnieJcQGyI1KApgvK3pRSjQurpUAa2ji9sYj9CRGS00k8H+tBpKs zFRpyGUVoeY1P+uXxezp7TVZgVb3ww5gGJiKT5ZNgCKtWRLNbVY8aQ7DcehHl62821QV uPaxXVvjTOkXA76tLcLlQbNR//bysq75XCQYvsSIM1yw94KjiEU8XykI2zgEnUkiTcAr nJI3zDS3nfEs5Dt/ew6oWg/D0pgQEL2OFql2PQbdbMpwTAiX7DrtJ9gSPuIMyhO33/Z8 I0gw== X-Gm-Message-State: AJcUukfzTqEINd7EBt+VUjP94xsfNT8xwero7vs76cY/Qb1j+9JQvf/u IW2o/S+JX5het8vLpZdhPNkrDJ5Zbfc= X-Google-Smtp-Source: ALg8bN4+4oKNp7lo+yU/RxAbTLs4J+ZvmnGztbn8BiQm8XIVgA1K7tNtYgZU1ANlbtCmJYhkDLrAlA== X-Received: by 2002:adf:93e2:: with SMTP id 89mr43167168wrp.129.1546518212841; Thu, 03 Jan 2019 04:23:32 -0800 (PST) From: Basil Salman To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 3 Jan 2019 14:23:22 +0200 Message-Id: <20190103122323.1273034-4-basil@daynix.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190103122323.1273034-1-basil@daynix.com> References: <20190103122323.1273034-1-basil@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-Mailman-Approved-At: Thu, 03 Jan 2019 10:10:24 -0500 Subject: [Qemu-devel] [PATCH 3/4] qga: Installer: Wait for installation to finish X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer , Bishara AbuHattoum Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Installation might fail if we don't wait for the provider unregisteration process to finish. Signed-off-by: Sameeh Jubran Signed-off-by: Basil Salman --- qga/installer/qemu-ga.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs index 64bf90bd85..f6781752e6 100644 --- a/qga/installer/qemu-ga.wxs +++ b/qga/installer/qemu-ga.wxs @@ -81,7 +81,7 @@ Arguments=3D"-d --retry-path" > - + --=20 2.17.2 From nobody Sat Oct 4 20:35:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1546528525947530.6731410004555; Thu, 3 Jan 2019 07:15:25 -0800 (PST) Received: from localhost ([127.0.0.1]:55229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf4iP-00008O-69 for importer@patchew.org; Thu, 03 Jan 2019 10:15:21 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf22C-0005FU-Ej for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gf22B-0004Dx-9u for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:36 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:42098) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gf22B-0004DN-48 for qemu-devel@nongnu.org; Thu, 03 Jan 2019 07:23:35 -0500 Received: by mail-wr1-x443.google.com with SMTP id q18so33377187wrx.9 for ; Thu, 03 Jan 2019 04:23:35 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id t76sm72325798wme.33.2019.01.03.04.23.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Jan 2019 04:23:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aS0ErmbN94onBZTh0RPsoeTA+8rMOGgk1WSn4rtb1wk=; b=GgVZNal4lsjNvwtfRfxpqwGYc1VgDBHEOjIsVSJno/AnhxQJOPjQNb2WeZerAbmxFj bmI28rdxR2lV/F11Vqi6+ZUq8t1DK5Yz8SNelcQF6se8krWEvGzoYjG2qYSGCP8oSjIO zT9dCevELkq0bO5HZx3bamt3UV54fs/QjfrjkGmI3vl7LShj+UeqJNOOZrSwYr9O1yWt 12X0wBQEHhRtWIqJi3iQqwR8jlaxLXIISv1mg1PDCMUGex7CVaTX3B4TIh3P+sKHXE9y EyT6oUGzGY0gJWS/k9pYds08ub4EK8Cb3WHNJpPy33qbguBzI1Rqw+pflUmGLZUww0ny 66Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aS0ErmbN94onBZTh0RPsoeTA+8rMOGgk1WSn4rtb1wk=; b=cADtmOT4QRdX/tOJC8p5UJKUm0KgokmBtXqVNGRpdTHL8Ri3tp5JUGVOULOoAjuD5p q8aSo+GIB5306ttwZ10k/DdbkK9V5uXOqxrlYY9lgbX+aLfc3HPMylNgEMLSZ5vE09VF ZVqN6ihKHv8QLZDiUEJKINbP/GjrZ5frBqHDcBYbsnnKs0C1317WSyZ3KNt1vmDEPBb6 UomeqHImu4SBpdi7G3fl5k3eSNC9MGKtM71hG7pZtNdwbPzqXlR6fPZghmLTEF59VsnJ HhfX6rOsSh/Gn7GrVn6AKJOwB7yG703oG1mWMC1tf4dTFFOT8Rr5rwdm/wkhrRoxHp86 O7eA== X-Gm-Message-State: AJcUukfhVrSydeRHrh6FXX1rogLLq9xXDpADzbu+ErdJYWLE2DVZpVEk JCvgJ22Ix7H5eulgm/Ngbs42/GM1394= X-Google-Smtp-Source: ALg8bN7GbeSu+nMF1bJzDponR2fuoUJDFh0JYBcKAc8+UjoKPoonxe8NB9sbKWT3U8bSoTgkZZxyqQ== X-Received: by 2002:adf:8544:: with SMTP id 62mr43466989wrh.1.1546518213991; Thu, 03 Jan 2019 04:23:33 -0800 (PST) From: Basil Salman To: qemu-devel@nongnu.org, Michael Roth Date: Thu, 3 Jan 2019 14:23:23 +0200 Message-Id: <20190103122323.1273034-5-basil@daynix.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190103122323.1273034-1-basil@daynix.com> References: <20190103122323.1273034-1-basil@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-Mailman-Approved-At: Thu, 03 Jan 2019 10:10:24 -0500 Subject: [Qemu-devel] [PATCH 4/4] qga-win: Handle VSS_E_PROVIDER_ALREADY_REGISTERED error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer , Bishara AbuHattoum Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sameeh Jubran This patch handles the case where VSS Provider is already registered, where in such case qga uninstalls the provider and registers it again. Signed-off-by: Sameeh Jubran Signed-off-by: Basil Salman --- qga/vss-win32/install.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index 6713e58670..28deeb9f0e 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -443,6 +443,16 @@ STDAPI DllRegisterServer(void) VSS_PROV_SOFTWARE, const_cast(QGA_PROVIDER_VERSI= ON), g_gProviderVersion); + if (hr =3D=3D (long int) VSS_E_PROVIDER_ALREADY_REGISTERED) + { + DllUnregisterServer(); + hr =3D pVssAdmin->RegisterProvider(g_gProviderId, CLSID_QGAVSSProv= ider, + const_cast(QGA_PROVIDER_L= NAME), + VSS_PROV_SOFTWARE, + const_cast(QGA_PROVIDER_V= ERSION), + g_gProviderVersion); + } + if (FAILED(hr)) { errmsg_dialog(hr, "RegisterProvider failed"); } --=20 2.17.2