diff options
author | Kevin Wolf <kwolf@redhat.com> | 2019-01-25 17:30:28 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2019-02-01 13:47:09 +0100 |
commit | a8f58afcdb86e266e06c9dc41a71605e570244c3 (patch) | |
tree | 134ff16e7c26dedbdbb60d951eb8be111c8a39b2 /hw/scsi | |
parent | a5df73baaf27a2aa4a911545ee1ee6286a5372e4 (diff) | |
download | qemu-a8f58afcdb86e266e06c9dc41a71605e570244c3.zip qemu-a8f58afcdb86e266e06c9dc41a71605e570244c3.tar.gz qemu-a8f58afcdb86e266e06c9dc41a71605e570244c3.tar.bz2 |
scsi-disk: Don't use empty string as device id
scsi-disk includes in the Device Identification VPD page, depending on
configuration amongst others, a vendor specific designator that consists
either of the serial number if given or the BlockBackend name (which is
a host detail that better shouldn't have been leaked to the guest, but
now we have to maintain it for compatibility).
With anonymous BlockBackends, i.e. scsi-disk devices constructed with
drive=<node-name>, and no serial number explicitly specified, this ends
up as an empty string. If this happens to more than one disk, we have
accidentally signalled to the OS that this is a multipath setup, which
is obviously not what was intended.
Instead of using an empty string for the vendor specific designator,
simply leave out that designator, which makes Linux detect such setups
as separate disks again.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r-- | hw/scsi/scsi-disk.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index b049026..11392a8 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -652,12 +652,14 @@ static int scsi_disk_emulate_vpd_page(SCSIRequest *req, uint8_t *outbuf) DPRINTF("Inquiry EVPD[Device identification] " "buffer size %zd\n", req->cmd.xfer); - outbuf[buflen++] = 0x2; /* ASCII */ - outbuf[buflen++] = 0; /* not officially assigned */ - outbuf[buflen++] = 0; /* reserved */ - outbuf[buflen++] = id_len; /* length of data following */ - memcpy(outbuf + buflen, str, id_len); - buflen += id_len; + if (id_len) { + outbuf[buflen++] = 0x2; /* ASCII */ + outbuf[buflen++] = 0; /* not officially assigned */ + outbuf[buflen++] = 0; /* reserved */ + outbuf[buflen++] = id_len; /* length of data following */ + memcpy(outbuf + buflen, str, id_len); + buflen += id_len; + } if (s->qdev.wwn) { outbuf[buflen++] = 0x1; /* Binary */ |