[SLOF] [PATCH 1/3] virtio-serial: Fix invalid stack access with closed virtio device
Thomas Huth
thuth at redhat.com
Mon Aug 28 16:56:17 AEST 2023
On 28/08/2023 03.37, Jordan Niethe wrote:
> When virtiodev is 0, its read method accesses beyond the end of the
> stack with nip. Instead finish with 1 on the stack to mirror the
> virtio-serial-getchar case and the behavior of the write method to
> return successfully even with the virtio device closed.
>
> Fixes: 8174acd ("virtio-serial: Close device completely")
> Co-developed-by: Kautuk Consul <kconsul at linux.vnet.ibm.com>
> Signed-off-by: Kautuk Consul <kconsul at linux.vnet.ibm.com>
> Signed-off-by: Jordan Niethe <jniethe5 at gmail.com>
> ---
> board-qemu/slof/virtio-serial.fs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board-qemu/slof/virtio-serial.fs b/board-qemu/slof/virtio-serial.fs
> index 82868e2..a67a310 100644
> --- a/board-qemu/slof/virtio-serial.fs
> +++ b/board-qemu/slof/virtio-serial.fs
> @@ -78,7 +78,7 @@ virtiodev virtio-serial-init drop
>
> : read ( addr len -- actual )
> 0= IF drop 0 EXIT THEN
> - virtiodev 0= IF nip EXIT THEN
> + virtiodev 0= IF drop 1 EXIT THEN
Wouldn't 0 make more sense than 1 ?
Thomas
More information about the SLOF
mailing list