[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/17] chardev: close QIOChannel before unref'ing
From: |
Daniel P . Berrangé |
Subject: |
[PULL 09/17] chardev: close QIOChannel before unref'ing |
Date: |
Fri, 9 Feb 2024 14:04:57 +0000 |
The chardev socket backend will unref the QIOChannel object while
it is still potentially open. When using TLS there could be a
pending TLS handshake taking place. If the channel is left open
then when the TLS handshake callback runs, it can end up accessing
free'd memory in the tcp_chr_tls_handshake method.
Closing the QIOChannel will unregister any pending handshake
source.
Reported-by: jiangyegen <jiangyegen@huawei.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
chardev/char-socket.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 73947da188..7105753815 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -378,6 +378,10 @@ static void tcp_chr_free_connection(Chardev *chr)
char_socket_yank_iochannel,
QIO_CHANNEL(s->sioc));
}
+
+ if (s->ioc) {
+ qio_channel_close(s->ioc, NULL);
+ }
object_unref(OBJECT(s->sioc));
s->sioc = NULL;
object_unref(OBJECT(s->ioc));
--
2.43.0
- [PULL 00/17] Misc fixes patches, Daniel P . Berrangé, 2024/02/09
- [PULL 01/17] meson: sort C warning flags alphabetically, Daniel P . Berrangé, 2024/02/09
- [PULL 02/17] crypto: Introduce SM4 symmetric cipher algorithm, Daniel P . Berrangé, 2024/02/09
- [PULL 03/17] qemu_init: increase NOFILE soft limit on POSIX, Daniel P . Berrangé, 2024/02/09
- [PULL 04/17] ui: drop VNC feature _MASK constants, Daniel P . Berrangé, 2024/02/09
- [PULL 05/17] softmmu: remove obsolete comment about libvirt timeouts, Daniel P . Berrangé, 2024/02/09
- [PULL 06/17] scripts: drop comment about autogenerated CPU API file, Daniel P . Berrangé, 2024/02/09
- [PULL 07/17] docs: fix highlighting of CPU ABI header rows, Daniel P . Berrangé, 2024/02/09
- [PULL 10/17] io: add trace event when cancelling TLS handshake, Daniel P . Berrangé, 2024/02/09
- [PULL 11/17] crypto: Support LUKS volume with detached header, Daniel P . Berrangé, 2024/02/09
- [PULL 09/17] chardev: close QIOChannel before unref'ing,
Daniel P . Berrangé <=
- [PULL 08/17] docs: re-generate x86_64 ABI compatibility CSV, Daniel P . Berrangé, 2024/02/09
- [PULL 12/17] qapi: Make parameter 'file' optional for BlockdevCreateOptionsLUKS, Daniel P . Berrangé, 2024/02/09
- [PULL 13/17] crypto: Modify the qcrypto_block_create to support creation flags, Daniel P . Berrangé, 2024/02/09
- [PULL 15/17] block: Support detached LUKS header creation using qemu-img, Daniel P . Berrangé, 2024/02/09
- [PULL 16/17] crypto: Introduce 'detached-header' field in QCryptoBlockInfoLUKS, Daniel P . Berrangé, 2024/02/09
- [PULL 14/17] block: Support detached LUKS header creation using blockdev-create, Daniel P . Berrangé, 2024/02/09
- [PULL 17/17] tests: Add case for LUKS volume with detached header, Daniel P . Berrangé, 2024/02/09
- Re: [PULL 00/17] Misc fixes patches, Peter Maydell, 2024/02/12