From patchwork Mon Jun 23 09:31:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 362701 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 012B414001A for ; Mon, 23 Jun 2014 19:33:53 +1000 (EST) Received: from localhost ([::1]:52309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz0dK-0005rw-Rz for incoming@patchwork.ozlabs.org; Mon, 23 Jun 2014 05:33:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz0bX-0002dp-Ix for qemu-devel@nongnu.org; Mon, 23 Jun 2014 05:32:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz0bS-0004fl-H4 for qemu-devel@nongnu.org; Mon, 23 Jun 2014 05:31:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz0bS-0004fb-9R for qemu-devel@nongnu.org; Mon, 23 Jun 2014 05:31:54 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5N9Vo4q023358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jun 2014 05:31:50 -0400 Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5N9VlKG003128; Mon, 23 Jun 2014 05:31:49 -0400 From: Stefan Hajnoczi To: Date: Mon, 23 Jun 2014 17:31:17 +0800 Message-Id: <1403515879-14359-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1403515879-14359-1-git-send-email-stefanha@redhat.com> References: <1403515879-14359-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Peter Maydell , Stefan Hajnoczi , Liu Yuan Subject: [Qemu-devel] [PULL 4/6] sheepdog: fix NULL dereference in sd_create X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Liu Yuan Following command qemu-img create -f qcow2 sheepdog:test 20g will cause core dump because aio_context is NULL in sd_create. We should initialize it by qemu_get_aio_context() to avoid NULL dereference. Cc: qemu-devel@nongnu.org Cc: Kevin Wolf Cc: Stefan Hajnoczi Signed-off-by: Liu Yuan Signed-off-by: Stefan Hajnoczi --- block/sheepdog.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/sheepdog.c b/block/sheepdog.c index 2dcc595..8d9350c 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1756,6 +1756,7 @@ static int sd_create(const char *filename, QemuOpts *opts, bdrv_unref(bs); } + s->aio_context = qemu_get_aio_context(); ret = do_sd_create(s, &vid, 0, errp); if (ret) { goto out;