From patchwork Tue Jun 18 14:16:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 252358 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0178C2C00A0 for ; Wed, 19 Jun 2013 00:18:06 +1000 (EST) Received: from localhost ([::1]:54835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UowjT-0000oZ-Tt for incoming@patchwork.ozlabs.org; Tue, 18 Jun 2013 10:18:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uowih-0000FO-GD for qemu-devel@nongnu.org; Tue, 18 Jun 2013 10:17:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uowic-0001PO-I1 for qemu-devel@nongnu.org; Tue, 18 Jun 2013 10:17:15 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:38208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uowic-0001P9-5D; Tue, 18 Jun 2013 10:17:10 -0400 Received: by mail-wi0-f177.google.com with SMTP id ey16so3277506wid.10 for ; Tue, 18 Jun 2013 07:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=TmrAB/EZrLWuGl2dSS3wn2ExP2PajJVEa+0mlKb02lg=; b=Iy6mfkZFqu/l2HThrKARsBn32u5sRSnGMx6S9bqqn5yATd3JZfIUO4maoK2z269DV2 rmZXNPpuIgwYgSh06wZdKonIBJtf/i6j5GDFt+Tvs77T5HKAKGfvcV2M8fTyZAbvv+vw AZ6kha8YKlXNetzB0isBjRMMEn+MVGYazfd7aSq5UZbSv6Eb2X6duxZVQ//kzgrB97+p hKN5lF74pCZHs4iwBeQMtI3dIjo5ssjMog25b+SGrwxAwA7InqOSnNJvdlHYg3CGvPtj fJ9XzzNVApw8ZcQ8JvAi+2lI1KnPM/1TRE4Yviz4lWHD7AIFuGCRDgeqqzHxwg+oU1F7 EL/w== X-Received: by 10.194.103.226 with SMTP id fz2mr10944568wjb.75.1371565029528; Tue, 18 Jun 2013 07:17:09 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id o14sm2385861wiv.3.2013.06.18.07.17.07 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 18 Jun 2013 07:17:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Jun 2013 16:16:52 +0200 Message-Id: <1371565016-2643-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1371565016-2643-1-git-send-email-pbonzini@redhat.com> References: <1371565016-2643-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::231 Cc: Pavel Hrdina , mdroth@linux.vnet.ibm.com, qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 3/7] scsi-generic: check the return value of bdrv_aio_ioctl in execute_command 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: Pavel Hrdina This fixes the bug introduced by this commit ad54ae80c73f. The bdrv_aio_ioctl() still could return null and we should return an error in that case. Cc: qemu-stable@nongnu.org Signed-off-by: Pavel Hrdina Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-generic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 19bd36c..8f195be 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -174,6 +174,9 @@ static int execute_command(BlockDriverState *bdrv, r->io_header.flags |= SG_FLAG_DIRECT_IO; r->req.aiocb = bdrv_aio_ioctl(bdrv, SG_IO, &r->io_header, complete, r); + if (r->req.aiocb == NULL) { + return -EIO; + } return 0; }