From patchwork Mon Jan 8 15:27:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 10149735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24CB7601BE for ; Mon, 8 Jan 2018 15:28:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26E99284D2 for ; Mon, 8 Jan 2018 15:28:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A8C4287FA; Mon, 8 Jan 2018 15:28:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 90C2E284D2 for ; Mon, 8 Jan 2018 15:28:42 +0000 (UTC) Received: from localhost ([::1]:40469 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYZLt-00010B-Px for patchwork-qemu-devel@patchwork.kernel.org; Mon, 08 Jan 2018 10:28:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYZL0-0000JF-It for qemu-devel@nongnu.org; Mon, 08 Jan 2018 10:27:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYZKw-0004nP-L2 for qemu-devel@nongnu.org; Mon, 08 Jan 2018 10:27:46 -0500 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:57327 helo=mx01.kamp.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eYZKw-0004m6-Cf for qemu-devel@nongnu.org; Mon, 08 Jan 2018 10:27:42 -0500 Received: (qmail 23047 invoked by uid 89); 8 Jan 2018 15:27:40 -0000 Received: from [195.62.97.192] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.99.2/24203. avast: 1.2.2/17010300. spamassassin: 3.4.1. Clear:RC:1(195.62.97.192):. Processed in 0.078622 secs); 08 Jan 2018 15:27:40 -0000 Received: from kerio.kamp.de ([195.62.97.192]) by mx01.kamp.de with ESMTPS (DHE-RSA-AES256-SHA encrypted); 8 Jan 2018 15:27:39 -0000 X-GL_Whitelist: yes X-Footer: a2FtcC5kZQ== Received: from submission.kamp.de ([195.62.97.28]) by kerio.kamp.de with ESMTPS (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) for qemu-devel@nongnu.org; Mon, 8 Jan 2018 16:27:36 +0100 Received: (qmail 3156 invoked from network); 8 Jan 2018 15:27:37 -0000 Received: from lieven-pc.kamp-intra.net (HELO lieven-pc) (relay@kamp.de@::ffff:172.21.12.60) by submission.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPA; 8 Jan 2018 15:27:37 -0000 Received: by lieven-pc (Postfix, from userid 1000) id 9A73220775; Mon, 8 Jan 2018 16:27:37 +0100 (CET) From: Peter Lieven To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 8 Jan 2018 16:27:27 +0100 Message-Id: <1515425247-21730-1-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.9.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:248:0:51::16 Subject: [Qemu-devel] [PATCH] block/iscsi: fix initialization of iTask in iscsi_co_get_block_status X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, famz@redhat.com, Peter Lieven , qemu-stable@nongnu.org, mreitz@redhat.com, ronniesahlberg@gmail.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP in case of unaligned requests or on a target that does not support block provisioning we leave iTask uninitialized and check iTask.task for NULL later. Fixes: e38bc23454ef763deb4405ebdee6a1081aa00bc8 Cc: qemu-stable@nongnu.org Signed-off-by: Peter Lieven Reviewed-by: Eric Blake --- block/iscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/iscsi.c b/block/iscsi.c index 5c0a9e5..6a1c537 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -658,6 +658,8 @@ static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs, uint64_t lba; int64_t ret; + iscsi_co_init_iscsitask(iscsilun, &iTask); + if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { ret = -EINVAL; goto out; @@ -675,7 +677,6 @@ static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs, lba = sector_qemu2lun(sector_num, iscsilun); - iscsi_co_init_iscsitask(iscsilun, &iTask); qemu_mutex_lock(&iscsilun->mutex); retry: if (iscsi_get_lba_status_task(iscsilun->iscsi, iscsilun->lun,