misc bugfixes for 5.2

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCgAGBQJfoszZAAoJEEy22O7T6HE4TzAP/AumhipHI/1gr/sRfoMjGL1M
 xVszXRu32J+k1gUxQuzU1hG6wnmlayX/98tM0p6K5YW8cSrWAV3RHqMISzz5/XDO
 gbeHVCspwOnYZkPE73DGKGUUJkst9dXr1KX7jDitwnlsZ/Kv/UIPORDlNV3DGDMN
 IgqhyfskDaBmmAthJt53C7i2+0MQONjFJKcVbrNTKYSnezCZfOSCRrdeUHPcN9Ev
 o1650+z/iUbqjyQyYyOEfY1jzkovIQ8piz3lNr2fOX0volBgDlHBmD6q2yWO2Fgi
 DA94x4UQbHp9p0blx7Fux7zWt+IV0tuKLk2zCcpEJrLybVQaw3Cp1UagTCLEpH5z
 SrYfTARJtbq3yS99lIyTVW6LC4KVNrfC3n1X8twpHWnnEni4qGyMeddGlO3eS8Oz
 kZ5BIBmCu5emRYe8ywCAwkvs/iPO85kXhEKCOzDgBXS3/5eqcDAavDttBgCVnU4b
 mTpWpwECw3UMAb+JCSl1nmvhZyvKir4nRr0+liNjGUOguj8d8bK4h3FL76sDJWAT
 Pq4v1cJH96JY5pKBnJ0aGiVKWpF/RSC+MQC+CcwFWU8QtMAtekHuRQD3zZbgdQ7x
 5zM/6fj/g+S/rY6SsRm+jxKHuPvj8/qvdPSOP73ADmuXVcxeMmfYvbnzPEe6P7uP
 26Tls8bYjUhNErsi3c2R
 =smOo
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/fixes-20201104-pull-request' into staging

misc bugfixes for 5.2

# gpg: Signature made Wed 04 Nov 2020 15:46:33 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/fixes-20201104-pull-request:
  roms/Makefile: Add qboot to .PHONY list
  ati: check x y display parameter values
  vnc: fix resource leak when websocket channel error

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-11-04 22:13:02 +00:00
commit e2766868d4
7 changed files with 47 additions and 18 deletions

View File

@ -75,8 +75,9 @@ void ati_2d_blt(ATIVGAState *s)
dst_stride *= bpp;
}
uint8_t *end = s->vga.vram_ptr + s->vga.vram_size;
if (dst_bits >= end || dst_bits + dst_x + (dst_y + s->regs.dst_height) *
dst_stride >= end) {
if (dst_x > 0x3fff || dst_y > 0x3fff || dst_bits >= end
|| dst_bits + dst_x
+ (dst_y + s->regs.dst_height) * dst_stride >= end) {
qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n");
return;
}
@ -107,8 +108,9 @@ void ati_2d_blt(ATIVGAState *s)
src_bits += s->regs.crtc_offset & 0x07ffffff;
src_stride *= bpp;
}
if (src_bits >= end || src_bits + src_x +
(src_y + s->regs.dst_height) * src_stride >= end) {
if (src_x > 0x3fff || src_y > 0x3fff || src_bits >= end
|| src_bits + src_x
+ (src_y + s->regs.dst_height) * src_stride >= end) {
qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n");
return;
}

View File

@ -102,7 +102,7 @@ build-seabios-config-%: config.%
OUT=$(CURDIR)/seabios/builds/$*/ all
.PHONY: sgabios skiboot
.PHONY: sgabios skiboot qboot
sgabios:
$(MAKE) -C sgabios
cp sgabios/sgabios.bin ../pc-bios

View File

@ -111,7 +111,8 @@ size_t vnc_client_write_sasl(VncState *vs)
g_source_remove(vs->ioc_tag);
}
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR,
vnc_client_io, vs, NULL);
}
return ret;

View File

@ -79,7 +79,8 @@ static void vnc_tls_handshake_done(QIOTask *task,
g_source_remove(vs->ioc_tag);
}
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_OUT,
vnc_client_io, vs, NULL);
start_auth_vencrypt_subauth(vs);
}
}

View File

@ -151,7 +151,8 @@ void vnc_jobs_consume_buffer(VncState *vs)
}
if (vs->disconnecting == FALSE) {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_OUT,
vnc_client_io, vs, NULL);
}
}
buffer_move(&vs->output, &vs->jobs_buffer);

View File

@ -41,13 +41,14 @@ static void vncws_tls_handshake_done(QIOTask *task,
g_source_remove(vs->ioc_tag);
}
vs->ioc_tag = qio_channel_add_watch(
QIO_CHANNEL(vs->ioc), G_IO_IN, vncws_handshake_io, vs, NULL);
QIO_CHANNEL(vs->ioc), G_IO_IN | G_IO_HUP | G_IO_ERR,
vncws_handshake_io, vs, NULL);
}
}
gboolean vncws_tls_handshake_io(QIOChannel *ioc G_GNUC_UNUSED,
GIOCondition condition G_GNUC_UNUSED,
GIOCondition condition,
void *opaque)
{
VncState *vs = opaque;
@ -59,6 +60,11 @@ gboolean vncws_tls_handshake_io(QIOChannel *ioc G_GNUC_UNUSED,
vs->ioc_tag = 0;
}
if (condition & (G_IO_HUP | G_IO_ERR)) {
vnc_client_error(vs);
return TRUE;
}
tls = qio_channel_tls_new_server(
vs->ioc,
vs->vd->tlscreds,
@ -105,13 +111,14 @@ static void vncws_handshake_done(QIOTask *task,
g_source_remove(vs->ioc_tag);
}
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR,
vnc_client_io, vs, NULL);
}
}
gboolean vncws_handshake_io(QIOChannel *ioc G_GNUC_UNUSED,
GIOCondition condition G_GNUC_UNUSED,
GIOCondition condition,
void *opaque)
{
VncState *vs = opaque;
@ -122,6 +129,11 @@ gboolean vncws_handshake_io(QIOChannel *ioc G_GNUC_UNUSED,
vs->ioc_tag = 0;
}
if (condition & (G_IO_HUP | G_IO_ERR)) {
vnc_client_error(vs);
return TRUE;
}
wioc = qio_channel_websock_new_server(vs->ioc);
qio_channel_set_name(QIO_CHANNEL(wioc), "vnc-ws-server-websock");

View File

@ -1398,7 +1398,8 @@ static size_t vnc_client_write_plain(VncState *vs)
g_source_remove(vs->ioc_tag);
}
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR,
vnc_client_io, vs, NULL);
}
return ret;
@ -1435,7 +1436,8 @@ static void vnc_client_write(VncState *vs)
g_source_remove(vs->ioc_tag);
}
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR,
vnc_client_io, vs, NULL);
}
vnc_unlock_output(vs);
}
@ -1551,6 +1553,12 @@ gboolean vnc_client_io(QIOChannel *ioc G_GNUC_UNUSED,
VncState *vs = opaque;
assert(vs->magic == VNC_MAGIC);
if (condition & (G_IO_HUP | G_IO_ERR)) {
vnc_disconnect_start(vs);
return TRUE;
}
if (condition & G_IO_IN) {
if (vnc_client_read(vs) < 0) {
/* vs is free()ed here */
@ -1612,7 +1620,8 @@ void vnc_write(VncState *vs, const void *data, size_t len)
g_source_remove(vs->ioc_tag);
}
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_OUT,
vnc_client_io, vs, NULL);
}
buffer_append(&vs->output, data, len);
@ -3077,14 +3086,17 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc,
vs->websocket = 1;
if (vd->tlscreds) {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vncws_tls_handshake_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR,
vncws_tls_handshake_io, vs, NULL);
} else {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vncws_handshake_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR,
vncws_handshake_io, vs, NULL);
}
} else {
vs->ioc_tag = qio_channel_add_watch(
vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);
vs->ioc, G_IO_IN | G_IO_HUP | G_IO_ERR,
vnc_client_io, vs, NULL);
}
vnc_client_cache_addr(vs);