From nobody Tue Jul 1 03:53:56 2025 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622803125; cv=none; d=zohomail.com; s=zohoarc; b=k0pGhqpuTsH8EUeaRb9MJmmpu4voqn2N8iZxe3TW6rqvLTHswMpBYHErqhJWdBBUd62hjGX8Ow3bQgDpaIoMgapVIRaH40o/ycDW9knQrBL5sST5W5YKXGZbn7FEid5sXtBROQY4OjGVg5i4buElLHi26IRcD5Ksr2wBmOmvOSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622803125; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=LTwhihyZ34F2ZiOUK4Eqr0NkaE4kPflSxNC+2bF8OKU=; b=RileEjmOKBZ9cj6rhpsLRMIMqDsekwJNraS3WZaW2Rpq80wQf3sx4C0XQJZwoSfNFBwmucJ4OrVxXVAA2692aoJe7VWfFW7jOsJMcLKuq6kL7nHGdD3sjyrYFMUm/Spsb4kzNV9fQ7tKMQNB1dGiEEAYMYkqoy4TQbFsijmX0DI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622803125414331.30394491071024; Fri, 4 Jun 2021 03:38:45 -0700 (PDT) Received: from localhost ([::1]:54026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lp7Dw-0003AX-Ba for importer2@patchew.org; Fri, 04 Jun 2021 06:38:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lp7Cm-0001kH-3P for qemu-devel@nongnu.org; Fri, 04 Jun 2021 06:37:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23071) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lp7Ci-0006EX-Kq for qemu-devel@nongnu.org; Fri, 04 Jun 2021 06:37:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-554-W1tkOaCCOV2yoTwj3nZGXA-1; Fri, 04 Jun 2021 06:37:26 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 419B8800D55 for ; Fri, 4 Jun 2021 10:37:25 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-69.ams2.redhat.com [10.36.113.69]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BBF54101E24F; Fri, 4 Jun 2021 10:37:15 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4BC4418007A2; Fri, 4 Jun 2021 12:37:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622803047; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LTwhihyZ34F2ZiOUK4Eqr0NkaE4kPflSxNC+2bF8OKU=; b=ZWUQU3xpaQt/Y96Qu/cmgFLOmYM0RYxCQwocWwTSl7XLT9slbYhXnVGsNSKznqQCWMvqPM kOe7XwnzcZu+unUhbNlCRrg1nCqh5zYSnGSxbFTrXiKKjGxu75E0ThCsHX+y5LDx3GsJDT GMW5aAUovitfTECyh0Q43/52/VHVqK0= X-MC-Unique: W1tkOaCCOV2yoTwj3nZGXA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH] vhost-user-gpu: reorder free calls. Date: Fri, 4 Jun 2021 12:37:14 +0200 Message-Id: <20210604103714.1237414-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.37, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Free in correct order to avoid use-after-free. Resolves: CID 1453812 Signed-off-by: Gerd Hoffmann Reviewed-by: Li Qiang Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-g= pu/vhost-user-gpu.c index 6dc6a44f4e26..611360e6b475 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -350,8 +350,8 @@ vg_resource_create_2d(VuGpu *g, if (!res->image) { g_critical("%s: resource creation failed %d %d %d", __func__, c2d.resource_id, c2d.width, c2d.height); - g_free(res); vugbm_buffer_destroy(&res->buffer); + g_free(res); cmd->error =3D VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY; return; } --=20 2.31.1