From: Laszlo Ersek <lersek@redhat.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org, Zhi Yong Wu <wuzhy@cn.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v2 00/16] net: Move legacy QEMU VLAN code into net/hub.c
Date: Wed, 25 Jul 2012 03:06:35 +0200 [thread overview]
Message-ID: <500F469B.9060302@redhat.com> (raw)
In-Reply-To: <1343144119-18757-1-git-send-email-stefanha@linux.vnet.ibm.com>
I'd like to review v2 tomorrow (ahem, today), ie. not right now, but
this catches my eye:
On 07/24/12 17:35, Stefan Hajnoczi wrote:
> * Drop spurious closesocket(fd), probably merge conflict [Stefan]
I saw it last time and I thought you had fixed a leak with it on the
side. The function looks as follows (right after applying [01 .. 02]
from v1):
[net/socket.c]
376 static void net_socket_accept(void *opaque)
377 {
378 NetSocketListenState *s = opaque;
379 NetSocketState *s1;
380 struct sockaddr_in saddr;
381 socklen_t len;
382 int fd;
383
384 for(;;) {
385 len = sizeof(saddr);
386 fd = qemu_accept(s->fd, (struct sockaddr *)&saddr, &len);
387 if (fd < 0 && errno != EINTR) {
388 return;
389 } else if (fd >= 0) {
390 break;
391 }
392 }
393 s1 = net_socket_fd_init(s->peer, s->model, s->name, fd, 1);
394 if (!s1) {
395 closesocket(fd);
396 } else {
397 snprintf(s1->nc.info_str, sizeof(s1->nc.info_str),
398 "socket: connection from %s:%d",
399 inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
400 }
401 }
If net_socket_fd_init() fails, then the file descriptor extracted by
qemu_accept() should be closed. The fix is not strongly related to the
series but I figured I'd let it slide :)
... Oh. net_socket_fd_init() takes ownership even if it fails, in which
case it calls closesocket() itself.
Such functions need a banner :)
Laszlo
next prev parent reply other threads:[~2012-07-25 1:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-24 15:35 [Qemu-devel] [PATCH v2 00/16] net: Move legacy QEMU VLAN code into net/hub.c Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 01/16] net: Add a hub net client Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 02/16] net: Use hubs for the vlan feature Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 03/16] net: Look up 'vlan' net clients using hubs Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 04/16] hub: Check that hubs are configured correctly Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 05/16] net: Drop vlan argument to qemu_new_net_client() Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 06/16] net: Convert qdev_prop_vlan to peer with hub Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 07/16] net: Remove vlan code from net.c Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 08/16] net: Remove VLANState Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 09/16] net: Rename non_vlan_clients to net_clients Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 10/16] net: Rename VLANClientState to NetClientState Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 11/16] net: Rename vc local variables to nc Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 12/16] net: Rename qemu_del_vlan_client() to qemu_del_net_client() Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 13/16] net: Make "info network" output more readable info Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 14/16] net: cleanup deliver/deliver_iov func pointers Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 15/16] net: determine if packets can be sent before net queue deliver packets Stefan Hajnoczi
2012-07-24 15:35 ` [Qemu-devel] [PATCH v2 16/16] hub: add the support for hub own flow control Stefan Hajnoczi
2012-07-25 1:06 ` Laszlo Ersek [this message]
2012-07-25 13:19 ` [Qemu-devel] [PATCH v2 00/16] net: Move legacy QEMU VLAN code into net/hub.c Laszlo Ersek
2012-07-30 15:49 ` Stefan Hajnoczi
2012-07-31 2:22 ` Zhi Yong Wu
2012-07-31 8:51 ` Stefan Hajnoczi
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=500F469B.9060302@redhat.com \
--to=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
--cc=wuzhy@cn.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.