Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2197887/?format=api
{ "id": 2197887, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2197887/?format=api", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.0/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260218202829.1322088-6-vsementsov@yandex-team.ru>", "date": "2026-02-18T20:28:21", "name": "[v3,05/12] net/tap: net_init_tap(): common fail label", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "1081d19c4860ceaed569bded0b969abc00ee5a94", "submitter": { "id": 84116, "url": "http://patchwork.ozlabs.org/api/1.0/people/84116/?format=api", "name": "Vladimir Sementsov-Ogievskiy", "email": "vsementsov@yandex-team.ru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260218202829.1322088-6-vsementsov@yandex-team.ru/mbox/", "series": [ { "id": 492602, "url": "http://patchwork.ozlabs.org/api/1.0/series/492602/?format=api", "date": "2026-02-18T20:28:20", "name": "net: refactoring and fixes", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/492602/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2197887/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru\n header.a=rsa-sha256 header.s=default header.b=dhPzQxh1;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)", "mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net;\n dkim=pass header.i=@yandex-team.ru" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fGSmZ0N4wz1xwC\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 19 Feb 2026 07:29:50 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vsoAU-0007E2-0J; Wed, 18 Feb 2026 15:29:06 -0500", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <vsementsov@yandex-team.ru>)\n id 1vsoA4-00074Z-3B\n for qemu-devel@nongnu.org; Wed, 18 Feb 2026 15:28:40 -0500", "from forwardcorp1a.mail.yandex.net ([178.154.239.72])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <vsementsov@yandex-team.ru>)\n id 1vsoA1-0007s2-Ub\n for qemu-devel@nongnu.org; Wed, 18 Feb 2026 15:28:39 -0500", "from mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net\n (mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net\n [IPv6:2a02:6b8:c2d:3530:0:640:eca4:0])\n by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id AFAD3C038E;\n Wed, 18 Feb 2026 23:28:36 +0300 (MSK)", "from vsementsov-lin (unknown [2a02:6bf:8080:53d::1:1b])\n by mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (smtpcorp/Yandex) with\n ESMTPSA id VShB144A8iE0-sDDid53j; Wed, 18 Feb 2026 23:28:36 +0300" ], "Precedence": "bulk", "X-Yandex-Fwd": "1", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru;\n s=default; t=1771446516;\n bh=zkwUUASolEhVxvg1YgpDo8GiYqPwUnrSrAAlmje9B6M=;\n h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From;\n b=dhPzQxh1YHd2OTyXJMr0kVnQgP9EDal5IpmpkymFU+7SwSiZVomwDmMU0SRi9EiVy\n PHYwmJFWbarXK3o0rY9nfFZzj/GcT2pcn5QfbGdyHYelSYxFl7mjALn6jiyMWrLnJ2\n YeBqhReJO3+CG0f9Mt9bCEYWIeZWTNEpgY+tgM3w=", "From": "Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>", "To": "jasowang@redhat.com", "Cc": "qemu-devel@nongnu.org, bchaney@akamai.com, yc-core@yandex-team.ru,\n d-tatianin@yandex-team.ru, davydov-max@yandex-team.ru,\n vsementsov@yandex-team.ru", "Subject": "[PATCH v3 05/12] net/tap: net_init_tap(): common fail label", "Date": "Wed, 18 Feb 2026 23:28:21 +0300", "Message-ID": "<20260218202829.1322088-6-vsementsov@yandex-team.ru>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260218202829.1322088-1-vsementsov@yandex-team.ru>", "References": "<20260218202829.1322088-1-vsementsov@yandex-team.ru>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=178.154.239.72;\n envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Add common failure label. This:\n\n- simplifies failure paths in the function\n- get rid of unusual free_fail: in the middle of the function\n- simplify further refactoring\n\nSigned-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>\n---\n net/tap.c | 84 ++++++++++++++++++++++++-------------------------------\n 1 file changed, 37 insertions(+), 47 deletions(-)", "diff": "diff --git a/net/tap.c b/net/tap.c\nindex 331a779585..2eb8a2caeb 100644\n--- a/net/tap.c\n+++ b/net/tap.c\n@@ -820,10 +820,12 @@ int net_init_tap(const Netdev *netdev, const char *name,\n NetClientState *peer, Error **errp)\n {\n const NetdevTapOptions *tap;\n- int fd, vnet_hdr = 0, i = 0, queues;\n+ int fd = -1, vnet_hdr = 0, i = 0, queues;\n /* for the no-fd, no-helper case */\n char ifname[128];\n- int ret = 0;\n+ char **fds = NULL, **vhost_fds = NULL;\n+ int nfds = 0, nvhosts = 0;\n+\n \n assert(netdev->type == NET_CLIENT_DRIVER_TAP);\n tap = &netdev->u.tap;\n@@ -867,31 +869,24 @@ int net_init_tap(const Netdev *netdev, const char *name,\n if (tap->fd) {\n fd = monitor_fd_param(monitor_cur(), tap->fd, errp);\n if (fd == -1) {\n- return -1;\n+ goto fail;\n }\n \n if (!qemu_set_blocking(fd, false, errp)) {\n- close(fd);\n- return -1;\n+ goto fail;\n }\n \n vnet_hdr = tap_probe_vnet_hdr(fd, errp);\n if (vnet_hdr < 0) {\n- close(fd);\n- return -1;\n+ goto fail;\n }\n \n if (!net_init_tap_one(tap, peer, \"tap\", name, NULL,\n NULL, NULL,\n tap->vhostfd, vnet_hdr, fd, errp)) {\n- close(fd);\n- return -1;\n+ goto fail;\n }\n } else if (tap->fds) {\n- char **fds;\n- char **vhost_fds;\n- int nfds = 0, nvhosts = 0;\n-\n fds = g_new0(char *, MAX_TAP_QUEUES);\n vhost_fds = g_new0(char *, MAX_TAP_QUEUES);\n \n@@ -901,77 +896,58 @@ int net_init_tap(const Netdev *netdev, const char *name,\n if (nfds != nvhosts) {\n error_setg(errp, \"The number of fds passed does not match \"\n \"the number of vhostfds passed\");\n- ret = -1;\n- goto free_fail;\n+ goto fail;\n }\n }\n \n for (i = 0; i < nfds; i++) {\n fd = monitor_fd_param(monitor_cur(), fds[i], errp);\n if (fd == -1) {\n- ret = -1;\n- goto free_fail;\n+ goto fail;\n }\n \n if (!qemu_set_blocking(fd, false, errp)) {\n- ret = -1;\n- goto free_fail;\n+ goto fail;\n }\n \n if (i == 0) {\n vnet_hdr = tap_probe_vnet_hdr(fd, errp);\n if (vnet_hdr < 0) {\n- ret = -1;\n- goto free_fail;\n+ goto fail;\n }\n } else if (vnet_hdr != tap_probe_vnet_hdr(fd, NULL)) {\n error_setg(errp,\n \"vnet_hdr not consistent across given tap fds\");\n- ret = -1;\n- goto free_fail;\n+ goto fail;\n }\n \n if (!net_init_tap_one(tap, peer, \"tap\", name, ifname,\n NULL, NULL,\n tap->vhostfds ? vhost_fds[i] : NULL,\n vnet_hdr, fd, errp)) {\n- ret = -1;\n- goto free_fail;\n+ goto fail;\n }\n }\n-\n-free_fail:\n- for (i = 0; i < nvhosts; i++) {\n- g_free(vhost_fds[i]);\n- }\n- for (i = 0; i < nfds; i++) {\n- g_free(fds[i]);\n- }\n- g_free(fds);\n- g_free(vhost_fds);\n- return ret;\n } else if (tap->helper) {\n fd = net_bridge_run_helper(tap->helper,\n tap->br ?: DEFAULT_BRIDGE_INTERFACE,\n errp);\n if (fd == -1) {\n- return -1;\n+ goto fail;\n }\n \n if (!qemu_set_blocking(fd, false, errp)) {\n- return -1;\n+ goto fail;\n }\n vnet_hdr = tap_probe_vnet_hdr(fd, errp);\n if (vnet_hdr < 0) {\n- close(fd);\n- return -1;\n+ goto fail;\n }\n \n if (!net_init_tap_one(tap, peer, \"bridge\", name, ifname,\n NULL, NULL, tap->vhostfd,\n vnet_hdr, fd, errp)) {\n- close(fd);\n- return -1;\n+ goto fail;\n }\n } else {\n g_autofree char *script =\n@@ -989,14 +965,13 @@ free_fail:\n fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? NULL : script,\n ifname, sizeof ifname, queues > 1, errp);\n if (fd == -1) {\n- return -1;\n+ goto fail;\n }\n \n if (queues > 1 && i == 0 && !tap->ifname) {\n if (tap_fd_get_ifname(fd, ifname)) {\n error_setg(errp, \"Fail to get ifname\");\n- close(fd);\n- return -1;\n+ goto fail;\n }\n }\n \n@@ -1004,13 +979,28 @@ free_fail:\n i >= 1 ? NULL : script,\n i >= 1 ? NULL : downscript,\n tap->vhostfd, vnet_hdr, fd, errp)) {\n- close(fd);\n- return -1;\n+ goto fail;\n }\n }\n }\n \n return 0;\n+\n+fail:\n+ close(fd);\n+ if (vhost_fds) {\n+ for (i = 0; i < nvhosts; i++) {\n+ g_free(vhost_fds[i]);\n+ }\n+ g_free(vhost_fds);\n+ }\n+ if (fds) {\n+ for (i = 0; i < nfds; i++) {\n+ g_free(fds[i]);\n+ }\n+ g_free(fds);\n+ }\n+ return -1;\n }\n \n int tap_enable(NetClientState *nc)\n", "prefixes": [ "v3", "05/12" ] }