mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
stash away SCM_RIGHTS fd until a getfd command arrives
If there is already a fd in s->msgfd before recvmsg it is closed by parts that this patch does not touch. So, only one descriptor can be "leaked" by attaching it to a command other than getfd. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
97331287ed
commit
e53f27b9d9
2 changed files with 3 additions and 15 deletions
|
@ -2000,8 +2000,9 @@ static void tcp_chr_process_IAC_bytes(CharDriverState *chr,
|
|||
static int tcp_get_msgfd(CharDriverState *chr)
|
||||
{
|
||||
TCPCharDriver *s = chr->opaque;
|
||||
|
||||
return s->msgfd;
|
||||
int fd = s->msgfd;
|
||||
s->msgfd = -1;
|
||||
return fd;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
|
@ -2089,10 +2090,6 @@ static void tcp_chr_read(void *opaque)
|
|||
tcp_chr_process_IAC_bytes(chr, s, buf, &size);
|
||||
if (size > 0)
|
||||
qemu_chr_read(chr, buf, size);
|
||||
if (s->msgfd != -1) {
|
||||
close(s->msgfd);
|
||||
s->msgfd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue