QEMU update with VENOM (CVE-2015-3456) patch
[packages/centos6/qemu.git] / 0211-iSCSI-We-need-to-support-SG_IO-also-from-iscsi_ioctl.patch
1 From 76fcbe46a52b467cd2cd96a671bfccd26871153e Mon Sep 17 00:00:00 2001
2 From: Ronnie Sahlberg <ronniesahlberg@gmail.com>
3 Date: Thu, 30 Aug 2012 17:28:40 -0700
4 Subject: [PATCH] iSCSI: We need to support SG_IO also from iscsi_ioctl()
5
6 We need to support SG_IO from the synchronous iscsi_ioctl() since
7 scsi-block uses this to do an INQ to the device to discover its properties
8 This patch makes scsi-block work with iscsi.
9
10 Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
11 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 (cherry picked from commit f1a12821d7df2e4d21be4f2206f84b4640533e53)
13
14 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
15 ---
16  block/iscsi.c | 17 +++++++++++++++++
17  1 file changed, 17 insertions(+)
18
19 diff --git a/block/iscsi.c b/block/iscsi.c
20 index 0b96165..ea16609 100644
21 --- a/block/iscsi.c
22 +++ b/block/iscsi.c
23 @@ -628,9 +628,17 @@ static BlockDriverAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
24      return &acb->common;
25  }
26  
27 +
28 +static void ioctl_cb(void *opaque, int status)
29 +{
30 +    int *p_status = opaque;
31 +    *p_status = status;
32 +}
33 +
34  static int iscsi_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
35  {
36      IscsiLun *iscsilun = bs->opaque;
37 +    int status;
38  
39      switch (req) {
40      case SG_GET_VERSION_NUM:
41 @@ -639,6 +647,15 @@ static int iscsi_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
42      case SG_GET_SCSI_ID:
43          ((struct sg_scsi_id *)buf)->scsi_type = iscsilun->type;
44          break;
45 +    case SG_IO:
46 +        status = -EINPROGRESS;
47 +        iscsi_aio_ioctl(bs, req, buf, ioctl_cb, &status);
48 +
49 +        while (status == -EINPROGRESS) {
50 +            qemu_aio_wait();
51 +        }
52 +
53 +        return 0;
54      default:
55          return -1;
56      }
57 -- 
58 1.7.12.1
59