From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLaop-0006cN-RW for qemu-devel@nongnu.org; Thu, 06 Mar 2014 11:06:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLaok-0002Sr-JX for qemu-devel@nongnu.org; Thu, 06 Mar 2014 11:06:47 -0500 Received: from lnantes-156-75-100-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:55856 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLaok-0002Si-CV for qemu-devel@nongnu.org; Thu, 06 Mar 2014 11:06:42 -0500 Date: Thu, 6 Mar 2014 17:06:41 +0100 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140306160641.GE22291@irqsave.net> References: <1394120669-4675-1-git-send-email-kwolf@redhat.com> <1394120669-4675-3-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1394120669-4675-3-git-send-email-kwolf@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/3] blockdev: Fix NULL pointer dereference in blockdev-add List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com The Thursday 06 Mar 2014 =E0 16:44:28 (+0100), Kevin Wolf wrote : > If aio=3Dnative, we check that cache.direct is set as well. If however > cache wasn't specified at all, qemu just segfaulted. >=20 > The old condition didn't make any sense anyway because it effectively > only checked for the default cache mode case, but not for an explicitly > set cache.direct=3Doff mode. >=20 > Signed-off-by: Kevin Wolf > --- > blockdev.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/blockdev.c b/blockdev.c > index 561cb81..c3422a1 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -2283,8 +2283,10 @@ void qmp_blockdev_add(BlockdevOptions *options, = Error **errp) > * > * For now, simply forbidding the combination for all drivers will= do. */ > if (options->has_aio && options->aio =3D=3D BLOCKDEV_AIO_OPTIONS_N= ATIVE) { > - bool direct =3D options->cache->has_direct && options->cache->= direct; > - if (!options->has_cache && !direct) { > + bool direct =3D options->has_cache && > + options->cache->has_direct && > + options->cache->direct; > + if (!direct) { > error_setg(errp, "aio=3Dnative requires cache.direct=3Dtru= e"); > goto fail; > } > --=20 > 1.8.1.4 >=20 >=20 Reviewed-by: Benoit Canet