From nobody Sat May 4 01:30:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547374070808401.56940823376215; Sun, 13 Jan 2019 02:07:50 -0800 (PST) Received: from localhost ([127.0.0.1]:60913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gicg3-0006de-El for importer@patchew.org; Sun, 13 Jan 2019 05:07:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giceJ-0005lz-Pm for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1giceI-0003Tg-JB for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:47 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:39010) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1giceH-0003SV-No for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:46 -0500 Received: by mail-wr1-x441.google.com with SMTP id t27so19596596wra.6 for ; Sun, 13 Jan 2019 02:05:45 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id j8sm62540340wmd.0.2019.01.13.02.05.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Jan 2019 02:05:43 -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=WOc8vSR8rKweq0+Lyb0TvKrrwrxAHawPLgiWz0CONeaIUNt81gSPdTnG0CWDytl9nq y5HpJN+yYBLP3SxiKy17HNlItxa4i957TdyuDcC1VZqWD4ZC/PlvFDPiuZhG4+JC0beI +2jKau0zSDTdI1+efwRXRqOO4sVJpMQO1Fxx62/cpcM5XyKXjFCKmEZIeBPIHJMUaKL5 I5z51rKu00767x0+8Bv4R7iUltBfFdJT3yyW7N6929iVtbiLdP8GsCBB4DN18Hg9Gauv t/rQFRTj9X2wbEKjfC4qrKHRBbZMoiEZWQWQbc8/CCeC+Q2JqIkE98jN/xD42N0rVEtf e1DQ== 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=nCzMpm0lHyoRogGR72MnTh/2oePu5xh9xqCSw8rJc+W5r4p9s/6f5Rh9Sy48JwVj9h ANNy8fBA05202J7ei7fp1nRfyNa8dQxCYrzsdsJWFOkh4qXOIv0B5sUA534k5iC16vAB e4uX27HjvU3JGFQnoA/+qc9mey3TP/5D8d5zhtTFHtoCnBgdOggMU4GGrXADGpqIV0Al O65HyabXDMc00T4xjrBy2HuyuiiQMIg/NHhJ15DOly/E5qseZqOYCrATh8q7njH0QROU JIRCtrDX0sAzE6wgA6XlE5V2BYHiN3yGEc1Vg3Uivy7p+4jHDSAUAy8Yo+qofQDLjYy3 /WyQ== X-Gm-Message-State: AJcUukfqUnkvJRoja8O0MD35KMHoEDxpkxe5P4+0NQpJyLcsKlHhoKLG M9i6e9qNlYhhjEg+r34QISsWe/gdrj4= X-Google-Smtp-Source: ALg8bN6dxKDiDV/WalOuimGL+sB9X75Nx8LJJBLtBHusj/1wF/1ywzrFwmTGDnZ40hwRz0mWqgmz+Q== X-Received: by 2002:a5d:4046:: with SMTP id w6mr21029217wrp.92.1547373943866; Sun, 13 Jan 2019 02:05:43 -0800 (PST) From: Basil Salman To: qemu-devel@nongnu.org, Michael Roth Date: Sun, 13 Jan 2019 12:05:28 +0200 Message-Id: <20190113100531.1346024-2-basil@daynix.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190113100531.1346024-1-basil@daynix.com> References: <20190113100531.1346024-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::441 Subject: [Qemu-devel] [PATCH v2 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 May 4 01:30:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547374071173133.91020133629468; Sun, 13 Jan 2019 02:07:51 -0800 (PST) Received: from localhost ([127.0.0.1]:60905 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gicg2-0006cZ-Bu for importer@patchew.org; Sun, 13 Jan 2019 05:07:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giceJ-0005lv-Fg for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1giceI-0003Tn-Kb for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:47 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38024) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1giceI-0003TL-Cy for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:46 -0500 Received: by mail-wr1-x442.google.com with SMTP id v13so19600566wrw.5 for ; Sun, 13 Jan 2019 02:05:46 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id j8sm62540340wmd.0.2019.01.13.02.05.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Jan 2019 02:05:44 -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=ibx8EV8+3AxkQMoeA9XteYJbJJMEkTnKA1RyupakyE6QTZ5NNwFPK5uwtTgrkA9RjX PgGuyHQaYQEL3003tFD6fDqfC36d82i461wUEMym3fKypeZHV/cyml/wKsuZcX0aIeUU CS5iSzA/gFkZE+Pyi/v8f4ZyXt6zVi2FAWE/bwKMTf7vKzYpMh/pIagBystt1KCNIiz6 ZqjENPk5eEliqbsjTzolhKnyz9P5rB7P+kUUpQNdMCtXYcjRBJVMzfjIj4H7HsLDcfPQ mFF0/jwVt3i//JpOvXECWsy1rQnBf7w4/hm2XmvnGEdTOUThwuuyktmseynGAVNZiAhC xXLA== 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=kglsHlNMrMDsA6V/oFssMy6UJOaYt/yI2DSu/4uIywaRBQ3g4rhC62r5wnIexw6y7L 9/jmBwmcmIaoy7WkSUUbR/9ZldeFq/htJjO1bUdTANuDbGqpqdd1pqvAzgLblLjC+hOc igZ6PseT4a0wN54ZoknuAE3dj1I//sf9tCfipxfVVOjA5ESDEam+/FB5+KHJGeFInPaA P6Cupkv2pPfy6YDtpJXgslyZXaWSbTd7WPgpxMZZoss14V43YZUqLiwhC5IpmiEqI97m u/2TCtex4D29wpxskePQSf/e3iZ2KZLKVwS/Bo0ucc6e28xzrjWEvXGDaK0OAhypEVSr 66SA== X-Gm-Message-State: AJcUukclwCPYibqm7XwTcnBlbjwvZWRP1YprFPEfiw9TA77MHpNIvW57 1/KcJ6UtsEaVzVHLVdUkp2s3G8plmLg= X-Google-Smtp-Source: ALg8bN5Jeltt1ZseeW9ms6+8KIffXovt12SZgUTMvHYNs39Lg0dz3fTGlvwfqYv2evh9g6g2nFIm6w== X-Received: by 2002:adf:c888:: with SMTP id k8mr21331787wrh.6.1547373945086; Sun, 13 Jan 2019 02:05:45 -0800 (PST) From: Basil Salman To: qemu-devel@nongnu.org, Michael Roth Date: Sun, 13 Jan 2019 12:05:29 +0200 Message-Id: <20190113100531.1346024-3-basil@daynix.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190113100531.1346024-1-basil@daynix.com> References: <20190113100531.1346024-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::442 Subject: [Qemu-devel] [PATCH v2 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 May 4 01:30:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547374191362443.29834307466376; Sun, 13 Jan 2019 02:09:51 -0800 (PST) Received: from localhost ([127.0.0.1]:33137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giciB-000897-1z for importer@patchew.org; Sun, 13 Jan 2019 05:09:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giceK-0005m9-KV for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1giceJ-0003V3-Nz for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:48 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:50366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1giceJ-0003Tx-HO for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:47 -0500 Received: by mail-wm1-x343.google.com with SMTP id n190so6114425wmd.0 for ; Sun, 13 Jan 2019 02:05:47 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id j8sm62540340wmd.0.2019.01.13.02.05.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Jan 2019 02:05:45 -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=ey1WTk35v/OrgP+xUYFSi3/r1Uf6Dcw8sw3FeUXHoTViGipxNirSTZ3lhvtC3iVyiY /mqWH52AxfUolR/ZosDYoSqO9uNlbK9E6mbUCvZfMHXQ3TEoXyfBAuFC6VrtTPP/ShWj mKhPtE1bbuxrn4YS5dGfHHsFfZ1Jc3OpQeP6gbeD0e46g2SxoPh3KZNOJq8oOvxJdAqb D4qWEvzB4K/2cgvL2t1CH82lmkdq0pUWN2WF27TYMeC4C/op6eda+9syPX6dztjW2fQz oots8qE7SNA9nUIIaisi8NQT4+VgRxPRE3if0F59ikRWCH8Y/WBdCkD1KlT+zIgCzN2B P9cg== 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=J6n5PR9cCGnN6FWUxHzBK+QJyScpG8MUX0GZ+OiAeBA12MlqmJagRgW+MBvDL5RKDp cq8MXH9qEyzppZDerWSuvvN5Td41BGT6YonNaWk7WtPvEWUE6HHeFJZDjS9Joe1BM6c9 06ESA9LnOTLg+5cTQvO1Bi43Q4a6rf/5bxUHEukr/HlCzGftvoJjFmABW9XArTFt7+60 UyhRHLDAzZujesNisYy49Gw6Se+kkvhuFfrJap3grd9ey4GxlTR2oezfrMD3YwdcYdif FWSVGmZPVBtGE5zXzDEhvmU4zo8FNCW0kDx8UjD42hw/YTJnPWuGONd7BWbn90xgQqTe BjAA== X-Gm-Message-State: AJcUukcO4AOHfqBsoTv55l/6GdxCCqxxAC70s/Koyk+gIthndbBu5wGQ MKDQamWG9IAHYbPOG4QwFh4sPVb7/BM= X-Google-Smtp-Source: ALg8bN6dDs9WX7WB6Xpd/6BVYFPqP48StnjUkJs91jdjqfVdqaSmUlVRyOxxPAe3YcRpeKCcS6sIPA== X-Received: by 2002:a1c:e18a:: with SMTP id y132mr8596857wmg.48.1547373946237; Sun, 13 Jan 2019 02:05:46 -0800 (PST) From: Basil Salman To: qemu-devel@nongnu.org, Michael Roth Date: Sun, 13 Jan 2019 12:05:30 +0200 Message-Id: <20190113100531.1346024-4-basil@daynix.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190113100531.1346024-1-basil@daynix.com> References: <20190113100531.1346024-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 Subject: [Qemu-devel] [PATCH v2 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 May 4 01:30:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547374191353449.51106716242543; Sun, 13 Jan 2019 02:09:51 -0800 (PST) Received: from localhost ([127.0.0.1]:33128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gici9-000883-J5 for importer@patchew.org; Sun, 13 Jan 2019 05:09:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giceL-0005mJ-Nt for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1giceK-0003W9-Vf for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:49 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:33743) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1giceK-0003VJ-P5 for qemu-devel@nongnu.org; Sun, 13 Jan 2019 05:05:48 -0500 Received: by mail-wm1-x342.google.com with SMTP id r24so5106531wmh.0 for ; Sun, 13 Jan 2019 02:05:48 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id j8sm62540340wmd.0.2019.01.13.02.05.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Jan 2019 02:05:46 -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=arRHgga2quA2/zACUqHImErod+MeexWEf7WnETjMy7A=; b=niImpI/dHe0rxpskyfWIg3LSWIkM+oQCKCLvsNyXXnT5HnhbQ82bUD04uIiKyBw0vq hRWxKnJpcfC8pQsmVb4caH/u4gfUqnNHYIe/F4qdk/S25QmE3l8ZsWurkn0Ov43cWEMj gGQwrIxhrYYq3Zp6AHkbWf/D9IAxd0OtQPkRNrX4qf6q5Iq/cJg4l5zGWk5kBqnH1PhN 4GiT/1gNthIqJg0ity8XRoDg9RENgd/SSa+Z1ZKc2LlqBcvZOnLrP6MZMBavheeHMX77 pfTE8qxo5pUkeVJzsCbzNb9BrFm6ts9lnagc8UYGPa094M5gtdD5O5QRE1OIIln0+jkO 2Xyw== 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=arRHgga2quA2/zACUqHImErod+MeexWEf7WnETjMy7A=; b=hkmaafeRUJN7KtidzWbxfglSORbaFETNKkpN6VYY3oSd+p6oJCabEnPqqwhecMGvx6 pZRHVEtbGThldWBVOgKvagWEb6vIi/EmMzgvhKWfR5hXAY/Cpf//ZhTqH5pOtGHxIk+8 GrA0FhahEInzUSoGu7zYMvrP8d6DfSoWM6HNGM0qFSs2OErlLieJ7jGdejLLVjMo5lSS JCD4t6HQdZuG88yDpnaWAHk/jQ1Nd73QVI0YaVKBhYPiytpq18bUuppZEndFpvXXgRk8 RHA6nTB0P9MFujPIr6fOQs7SfIVCM/F5ZQiorv09t+HMp84X11ZJChszAeuCWRl6O0Qc t11A== X-Gm-Message-State: AJcUukcZRsEDVCFtvwVSRSjYHB3NxmT5jimI85koI+Xdz1gkzH3HeWbb aRrSijRKSZhJzvyMDCgIf4uqRJ6+tZc= X-Google-Smtp-Source: ALg8bN7/X3QrZMs5N+RvHyE753OhGDA6TQGj9Q8QVUwWQqQSspAviLUXU7k8wrTYETBPfr6uL/Z64g== X-Received: by 2002:a1c:8484:: with SMTP id g126mr8404858wmd.117.1547373947408; Sun, 13 Jan 2019 02:05:47 -0800 (PST) From: Basil Salman To: qemu-devel@nongnu.org, Michael Roth Date: Sun, 13 Jan 2019 12:05:31 +0200 Message-Id: <20190113100531.1346024-5-basil@daynix.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190113100531.1346024-1-basil@daynix.com> References: <20190113100531.1346024-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::342 Subject: [Qemu-devel] [PATCH v2 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 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index 6713e58670..a456841360 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -443,6 +443,17 @@ 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_LNAME), + VSS_PROV_SOFTWARE, + const_cast + (QGA_PROVIDER_VERSION), + g_gProviderVersion); + } + if (FAILED(hr)) { errmsg_dialog(hr, "RegisterProvider failed"); } --=20 2.17.2