From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zotjp-0005LJ-BD for qemu-devel@nongnu.org; Wed, 21 Oct 2015 09:47:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zotjo-0000XG-GN for qemu-devel@nongnu.org; Wed, 21 Oct 2015 09:47:33 -0400 References: <1445270025-22999-1-git-send-email-mreitz@redhat.com> <1445270025-22999-28-git-send-email-mreitz@redhat.com> <20151020083351.GA6519@noname.redhat.com> From: Max Reitz Message-ID: <5627976A.8020400@redhat.com> Date: Wed, 21 Oct 2015 15:47:22 +0200 MIME-Version: 1.0 In-Reply-To: <20151020083351.GA6519@noname.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8h1lmk92KGxAvMu2Elo2kRajDUHb8DL6M" Subject: Re: [Qemu-devel] [PATCH v7 27/39] block: Add blk_remove_bs() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Alberto Garcia , qemu-block@nongnu.org, John Snow , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8h1lmk92KGxAvMu2Elo2kRajDUHb8DL6M Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 20.10.2015 10:33, Kevin Wolf wrote: > Am 19.10.2015 um 17:53 hat Max Reitz geschrieben: >> This function removes the BlockDriverState associated with the given >> BlockBackend from that BB and sets the BDS pointer in the BB to NULL. >> >> Signed-off-by: Max Reitz >> --- >> block/block-backend.c | 12 ++++++++++++ >> include/sysemu/block-backend.h | 1 + >> 2 files changed, 13 insertions(+) >> >> diff --git a/block/block-backend.c b/block/block-backend.c >> index 19fdaae..eb7409c 100644 >> --- a/block/block-backend.c >> +++ b/block/block-backend.c >> @@ -334,6 +334,18 @@ void blk_hide_on_behalf_of_hmp_drive_del(BlockBac= kend *blk) >> } >> =20 >> /* >> + * Disassociates the currently associated BlockDriverState from @blk.= >> + */ >> +void blk_remove_bs(BlockBackend *blk) >> +{ >> + blk_update_root_state(blk); >> + >> + bdrv_unref(blk->bs); >> + blk->bs->blk =3D NULL; >=20 > Use after free? Yes, indeed, will fix. Max >> + blk->bs =3D NULL; >> +} >=20 > Kevin >=20 --8h1lmk92KGxAvMu2Elo2kRajDUHb8DL6M Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWJ5dqAAoJEDuxQgLoOKytpJMH/iSzO3HpDXdUar4Hh+y91+Nf 9tBs6iE/wUSFiX94KF7EdLwHw/Juxuquj7bo7jT6PnFC53DCZlBdOahW8QdeWf5R cQBa1Sqa9/y7d9K6HTRZFM3UDxTTf9Gt9U4sC+910oKREw+Q+iI+F5gUkJRU6imp QZ8QSFxB7PwrviZpOKD+KqkmteSB2yn2HNb5bur+BT6LQ5gl9Kfze4lPklQ0M8aZ j0C6hEAr2MNehD0HzGxbJAgl3KeFaqTCZFd7HQugrFlv0nTYYxvb65VC+O54V4xO 2lMfV2z38NMUyhA8m1G4B9bCuscMLYxKDUsM89liOQTwDEE3Wml98PGNGkMCpmE= =jN1P -----END PGP SIGNATURE----- --8h1lmk92KGxAvMu2Elo2kRajDUHb8DL6M--