From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG3gJ-0001tu-EW for qemu-devel@nongnu.org; Thu, 23 Jun 2016 08:24:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bG3gF-0001BG-8M for qemu-devel@nongnu.org; Thu, 23 Jun 2016 08:24:27 -0400 References: <1466667001-10167-1-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <576BD4ED.6080301@redhat.com> Date: Thu, 23 Jun 2016 06:24:13 -0600 MIME-Version: 1.0 In-Reply-To: <1466667001-10167-1-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vtlHFA4Klokebmv868Kb4twwMREiCTIUV" Subject: Re: [Qemu-devel] [PATCH] block/qdev: Fix NULL access when using BB twice List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vtlHFA4Klokebmv868Kb4twwMREiCTIUV From: Eric Blake To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org Message-ID: <576BD4ED.6080301@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block/qdev: Fix NULL access when using BB twice References: <1466667001-10167-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1466667001-10167-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/23/2016 01:30 AM, Kevin Wolf wrote: > BlockBackend has only a single pointer to its guest device, so it makes= > sure that only a single guest device is attached to it. device-add > returns an error if you try to attach a second device to a BB. In order= > to make the error message nicer, -device that manually connects to a > if=3Dnone block device get a different message than -drive that implici= tly > creates a guest device. The if=3D... option is stored in DriveInfo. >=20 > However, since blockdev-add exists, not every BlockBackend has a > DriveInfo any more. Check that it exists before we dereference it. >=20 > QMP reproducer resulting in a segfault: >=20 > {"execute":"blockdev-add","arguments":{"options":{"id":"disk","driver":= "file","filename":"/tmp/test.img"}}} > {"execute":"device_add","arguments":{"driver":"virtio-blk-pci","drive":= "disk"}} > {"execute":"device_add","arguments":{"driver":"virtio-blk-pci","drive":= "disk"}} >=20 > Signed-off-by: Kevin Wolf > --- > hw/core/qdev-properties-system.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --vtlHFA4Klokebmv868Kb4twwMREiCTIUV 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXa9TuAAoJEKeha0olJ0NqSOIH/iqrG9SkvW3GD+PwGBzZPQok HeZFr2mOg2ekziidMjS0XaA0f2E+f+dJb5fCFr2LJao5CCmKf/9GxwKpALwR6F1g w6rnGEzl1xcRuCxfsjhamqrywQPU9org1BwCtdCGFryVWvtk1GUK0NYhMwuHQRQn i1td98Fgd5mMUo5dd/I57jEslYpCUXtEYmXgQxL1MtC13oMB/9GLIIrdRmN+6bJB Jby0Nq9okafuFp8uqiAxgsuB8wxcG/Ngmp7U/KZYweMn/YOMZ6uf2Fuo9XfSA0IJ q1YP7RSpL652nTU7NBf5mhJGM+xrTLQ7N1JffegS+tJiRCfhEbZmnptuCOTprl4= =ojfT -----END PGP SIGNATURE----- --vtlHFA4Klokebmv868Kb4twwMREiCTIUV--