From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1sPC-0004M9-0A for qemu-devel@nongnu.org; Tue, 01 Jul 2014 03:23:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1sP7-0004vB-Dg for qemu-devel@nongnu.org; Tue, 01 Jul 2014 03:23:05 -0400 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:60500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1sP7-0004tK-63 for qemu-devel@nongnu.org; Tue, 01 Jul 2014 03:23:01 -0400 Received: by mail-wi0-f179.google.com with SMTP id cc10so7208637wib.0 for ; Tue, 01 Jul 2014 00:23:00 -0700 (PDT) Date: Tue, 1 Jul 2014 09:22:57 +0200 From: Stefan Hajnoczi Message-ID: <20140701072257.GB24571@stefanha-thinkpad.redhat.com> References: <1404151417-474-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZfOjI3PrQbgiZnxM" Content-Disposition: inline In-Reply-To: <1404151417-474-1-git-send-email-peter.maydell@linaro.org> Subject: Re: [Qemu-devel] [PATCH for-2.1] block/cow: Avoid use of uninitialized cow_bs in error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Dong Xu Wang , qemu-devel@nongnu.org, Stefan Hajnoczi , Chunyan Liu --ZfOjI3PrQbgiZnxM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 30, 2014 at 07:03:37PM +0100, Peter Maydell wrote: > Commit 25814e8987 introduced an error-exit code path which does > a "goto exit" before the cow_bs variable is initialized, meaning > we would call bdrv_unref() on an uninitialized variable and > likely segfault. Fix this by moving the NULL-initialization > to the top of the function and making the exit code path handle > the case where it is NULL. >=20 > Signed-off-by: Peter Maydell > --- > block/cow.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) Thanks, applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan --ZfOjI3PrQbgiZnxM Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTsmHRAAoJEJykq7OBq3PIhJMIAL6om4wpa3cQheTMuqURVTfk IiOItIvPONCvUaQ+eVEuMd783AL9AmR9DojAqHTY3MIG7JlIhP6cFeJLf7KOvE// ciu5r5ZZyUL65JtctwYyT/mtqHcMYDexTs/0YzKRIKWRTaPEZ8nRNlEVsXIqW82b b7qvPjbPcTELc6YG0/dXTR57wLtk9lsnW2cmHNvIOpwZwvaJYpxNaYxp01801tDy I/IzqIKbcmjpxNwOMSJAPj99YOlX7TK3BlAT8B099yFCdCMZJDO76q3gNpwpumd2 hdowW662fLi9kqgeXUBn+9rutHfW6tbWsaUSyoIDQLFsfhlq3Gn9PCUu97NKxkI= =hDdC -----END PGP SIGNATURE----- --ZfOjI3PrQbgiZnxM--