qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>, qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Stefan Weil" <sw@weilnetz.de>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
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	[thread overview]
Message-ID: <c6ad433e-7327-4fcb-180c-e161919c0aa3@redhat.com> (raw)
In-Reply-To: <20200701193951.36248-2-lvivier@redhat.com>


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



  parent reply	other threads:[~2020-07-07  7:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 19:39 [PATCH v3 0/2] net: tap: check file descriptor can be used Laurent Vivier
2020-07-01 19:39 ` [PATCH v3 1/2] net: tap: check if the file descriptor is valid before using it Laurent Vivier
2020-07-02  8:00   ` Philippe Mathieu-Daudé
2020-07-02  8:17     ` Laurent Vivier
2020-07-02  8:18       ` Philippe Mathieu-Daudé
2020-07-06  8:45         ` Philippe Mathieu-Daudé
2020-07-07  7:56   ` Jason Wang [this message]
2020-07-07 10:21     ` Laurent Vivier
2020-07-01 19:39 ` [PATCH v3 2/2] net: detect errors from probing vnet hdr flag for TAP devices Laurent Vivier
2020-07-06  8:47   ` Philippe Mathieu-Daudé
2020-07-06  8:21 ` [PATCH v3 0/2] net: tap: check file descriptor can be used Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c6ad433e-7327-4fcb-180c-e161919c0aa3@redhat.com \
    --to=jasowang@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).