virtio-serial: fix ANY_LAYOUT
PATCH 1/1 virtio-serial: fix ANY_LAYOUT
Don't assume a specific layout for control messages. Required by virtio 1.
--- hw/char/virtio-serial-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/char/virtio-serial-bus.c +2 -1
@@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)return 0 ; } -memcpy (elem.in_sg[0 ].iov_base, buf, len); +/* TODO: detect a buffer that's too short, set NEEDS_RESET */ +iov_from_buf (&elem.in_sg, buf, len);virtqueue_push (vq, &elem, len);virtio_notify (VIRTIO_DEVICE (vser), vq);
Signature · 1 line
MST
Quoted 4 lines · Michael S. Tsirkin
Don't assume a specific layout for control messages. Required by virtio 1.
Signed-off-by Michael S. Tsirkin <[email protected]>
Quoted 9 lines
--- hw/char/virtio-serial-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/char/virtio-serial-bus.c +0
-0
hw/char/virtio-serial-bus.c static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len) · line 199
Quoted 6 lines
hw/char/virtio-serial-bus.c +2
-1@@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)return 0 ; } -memcpy (elem.in_sg[0 ].iov_base, buf, len); +/* TODO: detect a buffer that's too short, set NEEDS_RESET */ +iov_from_buf (&elem.in_sg, buf, len);
Not sure why NEEDS_RESET -- anyhow, you planning on doing this?
Amit
Quoted 20 lines · Amit Shah
Quoted 4 lines · Michael S. Tsirkin
Don't assume a specific layout for control messages. Required by virtio 1.
Signed-off-by Michael S. Tsirkin <[email protected]>Reviewed-by Amit Shah <[email protected]>Quoted 12 lines
--- hw/char/virtio-serial-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/char/virtio-serial-bus.c +0
-0@@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)return 0 ; }
Quoted 8 lines
hw/char/virtio-serial-bus.c static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len) · line 199
Quoted 3 lines
hw/char/virtio-serial-bus.c +2
-1-memcpy (elem.in_sg[0 ].iov_base, buf, len); +/* TODO: detect a buffer that's too short, set NEEDS_RESET */ +iov_from_buf (&elem.in_sg, buf, len);Not sure why
NEEDS_RESET-- anyhow, you planning on doing this?Amit
Definitely not for 2.4.
It's a guest bug, we need a consistent strategy for handling these.
Signature · 1 line
MST
Quoted 13 lines · Michael S. Tsirkin
Don't assume a specific layout for control messages. Required by virtio 1.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/char/virtio-serial-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/char/virtio-serial-bus.c +0
-0
hw/char/virtio-serial-bus.c static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len) · line 202
Quoted 9 lines
hw/char/virtio-serial-bus.c +2
-1@@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)return 0 ; } -memcpy (elem.in_sg[0 ].iov_base, buf, len); +/* TODO: detect a buffer that's too short, set NEEDS_RESET */ +iov_from_buf (&elem.in_sg, buf, len);virtqueue_push (vq, &elem, len);virtio_notify (VIRTIO_DEVICE (vser), vq);