KVM: s390: virtio-ccw: don't overwrite config space values
KVM: s390: virtio-ccw: don't overwrite config space values

Eric noticed problems with vhost-scsi and virtio-ccw: vhost-scsi
complained about overwriting values in the config space, which
was triggered by a broken implementation of virtio-ccw's config
get/set routines. It was probably sheer luck that we did not hit
this before.

When writing a value to the config space, the WRITE_CONF ccw will
always write from the beginning of the config space up to and
including the value to be set. If the config space up to the value
has not yet been retrieved from the device, however, we'll end up
overwriting values. Keep track of the known config space and update
if needed to avoid this.

Moreover, READ_CONF will only read the number of bytes it has been
instructed to retrieve, so we must not copy more than that to the
buffer, or we might overwrite trailing values.

Reported-by: Eric Farman <45cff695b8fa5cc07d58f6876a8fd504d010e3e3@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <94980dd689360e06f79e918bf71ea5fed7a2bc63@de.ibm.com>
Reviewed-by: Eric Farman <45cff695b8fa5cc07d58f6876a8fd504d010e3e3@linux.vnet.ibm.com>
Tested-by: Eric Farman <45cff695b8fa5cc07d58f6876a8fd504d010e3e3@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <49712f635b03c16d7f4c43df70e49ec8c565813d@de.ibm.com>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Signed-off-by: Paolo Bonzini <69d3ebcf5ee4e7f05a50dc23cd96655b730804b4@redhat.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs