mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
virtiofsd: fv_create_listen_socket error path socket leak
If we fail when bringing up the socket we can leak the listen_fd; in practice the daemon will exit so it's not really a problem. Fixes: Coverity CID 1413121 Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
988717b46b
commit
6fa249027f
1 changed files with 2 additions and 0 deletions
|
@ -916,6 +916,7 @@ static int fv_create_listen_socket(struct fuse_session *se)
|
||||||
old_umask = umask(0077);
|
old_umask = umask(0077);
|
||||||
if (bind(listen_sock, (struct sockaddr *)&un, addr_len) == -1) {
|
if (bind(listen_sock, (struct sockaddr *)&un, addr_len) == -1) {
|
||||||
fuse_log(FUSE_LOG_ERR, "vhost socket bind: %m\n");
|
fuse_log(FUSE_LOG_ERR, "vhost socket bind: %m\n");
|
||||||
|
close(listen_sock);
|
||||||
umask(old_umask);
|
umask(old_umask);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -923,6 +924,7 @@ static int fv_create_listen_socket(struct fuse_session *se)
|
||||||
|
|
||||||
if (listen(listen_sock, 1) == -1) {
|
if (listen(listen_sock, 1) == -1) {
|
||||||
fuse_log(FUSE_LOG_ERR, "vhost socket listen: %m\n");
|
fuse_log(FUSE_LOG_ERR, "vhost socket listen: %m\n");
|
||||||
|
close(listen_sock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue