From nobody Mon Feb 9 08:57:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619799931; cv=none; d=zohomail.com; s=zohoarc; b=TRfNIbqLYQF5oVhzwWCX7dOylOv1z4I6Kao612QS9ScEiL599tCkicevGHiruX8rQ3Di+DG7pwZVBB05RvwnSlLScj6ByiuLhTtzR2eX/Z/xtPfGQCI1Cr2ztX1pUNd42c8Ha6TqmHT8+LcixYL8sIXDAfrZov3k7LK24iNYcq8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619799931; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=4L0T4eT8dybX7s5E/1hWaD9F1Awp7eU+MGs6+A+hFYI=; b=JyUdao8ngzYu7jT8AfTSx/xmwFtK5MpoVBFwEqk6HscGfZ/7oFKaiUzeCkxZ5AVE5q6uQ4LvLWoBLmYbCm3WE42sWlBSccRWQQ0wT78+Ylii6RCyioaQrdHKFQ3UY3nPArHLNiif7F+Fya6dMN5FHjnrICAGnalJG28aPJv2DJg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1619799931468171.53854382308168; Fri, 30 Apr 2021 09:25:31 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-LjHFi7SzOn-8z3CBVg_inQ-1; Fri, 30 Apr 2021 12:25:27 -0400 Received: by mail-wr1-f71.google.com with SMTP id h60-20020adf90420000b029010418c4cd0cso24832996wrh.12 for ; Fri, 30 Apr 2021 09:25:27 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (anancy-651-1-208-144.w109-217.abo.wanadoo.fr. [109.217.237.144]) by smtp.gmail.com with ESMTPSA id q12sm2683952wrx.17.2021.04.30.09.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 09:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619799930; 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: in-reply-to:in-reply-to:references:references; bh=4L0T4eT8dybX7s5E/1hWaD9F1Awp7eU+MGs6+A+hFYI=; b=NWRkGBcPY+T0jakLerGhNkdz/luwSnhpICJ4vVvpBzt8XHMOJoVYlq2kFlR00vzLV8H4kj tixAwQgB3QDTKjePiCaBqlfplZalxuEhsJRDiB8hici75WsJjl/VAU1wL0rAXqF+9Jkp+k GmKUR0Y2poVJXoPbGreUQ/Es8kTNJQQ= X-MC-Unique: LjHFi7SzOn-8z3CBVg_inQ-1 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:mime-version:content-transfer-encoding; bh=4L0T4eT8dybX7s5E/1hWaD9F1Awp7eU+MGs6+A+hFYI=; b=izpCSwcxth6Z95KA2y/sB5Kv25xAzXQaqnCRe1CR4WVhY/ath3lRViIWY1Sc2jiN4v EyYMD2bv3O8n5I37Xn79bkET8uuSzngKnHDN5yR3FL6j5gAXON4HQAL3YCZUdz4P2sba xMF3mtXg1FbcMkyevPL3bpLSUnjO1ebcSe5oadX7LSLbtwDaeRjSmCbQ7aWosiCGg8+o k/OSGgm62kBUFVoHW6nA/foYcbtxQl4dzSfC8f1wJboJpxdurFXzHvSzMyB7ogNVElqw +FZ9OAREx5KQtQcbQaz9RIexINf6XUrpkm9yE2B3tdT69nMhxD1ShE9rbYHJOIcGL2ge woNg== X-Gm-Message-State: AOAM533RXMVMEULAEMTiFHqSP6ZL/AASrZ08FKZffSGszgWR1EdQkPgE sIUEJuSpUHDXFEuizL6wHQXP3bO19ZQ5OZ5TgdYGjUm4NiIg/eg3whgVTiWwKKcUQ0ZFKpudLQz j4ueopLASCUx2ew== X-Received: by 2002:adf:ef92:: with SMTP id d18mr8245064wro.413.1619799926849; Fri, 30 Apr 2021 09:25:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvSlW20BDkkdo1j2FQ9IFY1p6p35jd8qxFT5zMwdt5O7xYYY9Gg2Qtn3P5VFy8nKAXAbHxjw== X-Received: by 2002:adf:ef92:: with SMTP id d18mr8245051wro.413.1619799926728; Fri, 30 Apr 2021 09:25:26 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Max Reitz , Kevin Wolf , Johannes Schindelin , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/4] block/vvfat: Fix leak of BDRVVVFATState::qcow_filename Date: Fri, 30 Apr 2021 18:25:16 +0200 Message-Id: <20210430162519.271607-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210430162519.271607-1-philmd@redhat.com> References: <20210430162519.271607-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) qcow_filename is allocated in enable_write_target(), called by vvfat_open(), but never free'd. Free it in vvfat_close(). This fixes (QEMU built with --enable-sanitizers): Direct leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x55d7a363773f in malloc (/mnt/scratch/qemu/sanitizer/qemu-system-= x86_64+0x1dab73f) #1 0x7f55c6447958 in g_malloc (/lib64/libglib-2.0.so.0+0x58958) #2 0x55d7a5e123aa in vvfat_open block/vvfat.c:1236:19 #3 0x55d7a5a5363f in bdrv_open_driver block.c:1526:15 #4 0x55d7a5a9d369 in bdrv_open_common block.c:1802:11 #5 0x55d7a5a609f1 in bdrv_open_inherit block.c:3444:11 #6 0x55d7a5a65411 in bdrv_open_child_bs block.c:3079:10 #7 0x55d7a5a60079 in bdrv_open_inherit block.c:3391:19 #8 0x55d7a5a65da3 in bdrv_open block.c:3537:12 #9 0x55d7a5b33f6a in blk_new_open block/block-backend.c:421:10 #10 0x55d7a5a0a33e in blockdev_init blockdev.c:610:15 #11 0x55d7a5a088e7 in drive_new blockdev.c:994:11 #12 0x55d7a51b10c4 in drive_init_func softmmu/vl.c:636:12 #13 0x55d7a620e148 in qemu_opts_foreach util/qemu-option.c:1167:14 #14 0x55d7a51b0e20 in configure_blockdev softmmu/vl.c:695:9 #15 0x55d7a51a70b5 in qemu_create_early_backends softmmu/vl.c:1895:5 #16 0x55d7a519bf87 in qemu_init softmmu/vl.c:3551:5 #17 0x55d7a366f619 in main softmmu/main.c:49:5 Fixes: 8475ea48544 ("block/vvfat: Do not unref qcow on closing backing bdrv= ") Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella --- block/vvfat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/vvfat.c b/block/vvfat.c index 54807f82ca1..5a4a7915220 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -3233,6 +3233,7 @@ static void vvfat_close(BlockDriverState *bs) array_free(&(s->directory)); array_free(&(s->mapping)); g_free(s->cluster_buffer); + g_free(s->qcow_filename); =20 if (s->qcow) { migrate_del_blocker(s->migration_blocker); --=20 2.26.3