[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/2] net: tap: check if the file descriptor is valid befor
From: |
Jason Wang |
Subject: |
Re: [PATCH v3 1/2] net: tap: check if the file descriptor is valid before using it |
Date: |
Tue, 7 Jul 2020 15:56:24 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
On 2020/7/2 上午3:39, Laurent Vivier wrote:
+void qemu_set_nonblock(int fd)
+{
+ int f;
+ f = qemu_try_set_nonblock(fd);
+ assert(f == 0);
}
So we keep this assert which means it can still be triggered from monitor?
I don't check all the callers, but I got:
in tap_init_one() we had:
if (vhostfdname) {
vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);
if (vhostfd == -1) {
if (tap->has_vhostforce && tap->vhostforce) {
error_propagate(errp, err);
} else {
warn_report_err(err);
}
return;
}
qemu_set_nonblock(vhostfd);
} else {
and in net_init_socket() we had:
if (sock->has_fd) {
int fd;
fd = monitor_fd_param(cur_mon, sock->fd, errp);
if (fd == -1) {
return -1;
}
qemu_set_nonblock(fd);
if (!net_socket_fd_init(peer, "socket", name, fd, 1, sock->mcast,
errp)) {
return -1;
}
return 0;
}
Thanks
[PATCH v3 2/2] net: detect errors from probing vnet hdr flag for TAP devices, Laurent Vivier, 2020/07/01
Re: [PATCH v3 0/2] net: tap: check file descriptor can be used, Laurent Vivier, 2020/07/06