From nobody Mon Nov 3 18:29:38 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; 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 1505766439373933.6706430423783; Mon, 18 Sep 2017 13:27:19 -0700 (PDT) Received: from localhost ([::1]:38780 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1du2dR-0000lB-Tf for importer@patchew.org; Mon, 18 Sep 2017 16:27:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1du2cc-0000J9-5Z for qemu-devel@nongnu.org; Mon, 18 Sep 2017 16:26:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1du2cY-0006nf-4B for qemu-devel@nongnu.org; Mon, 18 Sep 2017 16:26:26 -0400 Received: from smtp1.ntua.gr ([2001:648:2000:de::183]:57515) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1du2cX-0006mv-Op; Mon, 18 Sep 2017 16:26:22 -0400 Received: from mail.ntua.gr (carp0.noc.ntua.gr [147.102.222.60]) (authenticated bits=0) by smtp1.ntua.gr (8.15.2/8.15.2) with ESMTPSA id v8IKPd4b039612 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Sep 2017 23:25:42 +0300 (EEST) (envelope-from el13635@mail.ntua.gr) X-Authentication-Warning: smtp1.ntua.gr: Host carp0.noc.ntua.gr [147.102.222.60] claimed to be mail.ntua.gr From: Manos Pitsidianakis To: qemu-block Date: Mon, 18 Sep 2017 23:25:29 +0300 Message-Id: <20170918202529.28379-1-el13635@mail.ntua.gr> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:648:2000:de::183 Subject: [Qemu-devel] [PATCH] block/throttle-groups.c: allocate RestartData on the heap 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: Kevin Wolf , Max Reitz , Alberto Garcia , qemu-devel , qemu-stable Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" RestartData is the opaque data of the throttle_group_restart_queue_entry coroutine. By being stack allocated, it isn't available anymore if aio_co_enter schedules the coroutine with a bottom halve and runs after throttle_group_restart_queue returns. Signed-off-by: Manos Pitsidianakis Reviewed-by: Alberto Garcia Reviewed-by: Eric Blake --- block/throttle-groups.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 6ba992c8d7..b291a88481 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -403,17 +403,19 @@ static void coroutine_fn throttle_group_restart_queue= _entry(void *opaque) schedule_next_request(tgm, is_write); qemu_mutex_unlock(&tg->lock); } + + g_free(data); } =20 static void throttle_group_restart_queue(ThrottleGroupMember *tgm, bool is= _write) { Coroutine *co; - RestartData rd =3D { - .tgm =3D tgm, - .is_write =3D is_write - }; + RestartData *rd =3D g_new0(RestartData, 1); =20 - co =3D qemu_coroutine_create(throttle_group_restart_queue_entry, &rd); + rd->tgm =3D tgm; + rd->is_write =3D is_write; + + co =3D qemu_coroutine_create(throttle_group_restart_queue_entry, rd); aio_co_enter(tgm->aio_context, co); } =20 --=20 2.11.0