Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2227459/?format=api
{ "id": 2227459, "url": "http://patchwork.ozlabs.org/api/patches/2227459/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260423191958.1440-24-farosas@suse.de/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/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": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260423191958.1440-24-farosas@suse.de>", "list_archive_url": null, "date": "2026-04-23T19:19:37", "name": "[PULL,23/43] migration: fix QIOChannelFile leak on error in file_connect_outgoing", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5b469e523ef2ad96b62edb2e77400a8a04409bf0", "submitter": { "id": 85343, "url": "http://patchwork.ozlabs.org/api/people/85343/?format=api", "name": "Fabiano Rosas", "email": "farosas@suse.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260423191958.1440-24-farosas@suse.de/mbox/", "series": [ { "id": 501236, "url": "http://patchwork.ozlabs.org/api/series/501236/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501236", "date": "2026-04-23T19:19:14", "name": "[PULL,01/43] checkpatch: Allow spaces after all coroutine annotations", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501236/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227459/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227459/checks/", "tags": {}, "related": [], "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=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=Ku/6DBjM;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=trog1vFo;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=Ku/6DBjM;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=trog1vFo;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)", "smtp-out2.suse.de;\n\tnone" ], "Received": [ "from lists1p.gnu.org (lists1p.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 4g1mF51k93z1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 05:22:17 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wFzcJ-0002rS-CD; Thu, 23 Apr 2026 15:21:39 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <farosas@suse.de>) id 1wFzc0-0002IJ-4q\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 15:21:27 -0400", "from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <farosas@suse.de>) id 1wFzbw-0001ve-G5\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 15:21:19 -0400", "from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id 2BD575BD80;\n Thu, 23 Apr 2026 19:20:35 +0000 (UTC)", "from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 26249593A3;\n Thu, 23 Apr 2026 19:20:33 +0000 (UTC)", "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id uBP2OAFx6mlJCwAAD6G6ig\n (envelope-from <farosas@suse.de>); Thu, 23 Apr 2026 19:20:33 +0000" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776972035;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=9+dWxIjEbtZWJM6lJ1p1SMQ30hrcIj1G1U4aBy3qzDI=;\n b=Ku/6DBjMRxNiD9US9YvoKTBQBhk4U3F5gF2346lfP+wLOSmAS5KX2f5Yv4LWsgpru+rrh+\n u6vhAZffKBSh3ntJdpQHFiD0VroJIb/1rCMkeH11ycEHTiDzQ3GHBYQNUFEI/67zz/jVl8\n JMTdycS49gTRm0dFMuBeV8BBa7Tv99w=", "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776972035;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=9+dWxIjEbtZWJM6lJ1p1SMQ30hrcIj1G1U4aBy3qzDI=;\n b=trog1vFoWLnLJRghEK47xStnTzIrsQqMU1G6xOHRUWAnshA50vnHlpy7jkw6YbM/w5ZWle\n bF3DEZlSzK9pYKDQ==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776972035;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=9+dWxIjEbtZWJM6lJ1p1SMQ30hrcIj1G1U4aBy3qzDI=;\n b=Ku/6DBjMRxNiD9US9YvoKTBQBhk4U3F5gF2346lfP+wLOSmAS5KX2f5Yv4LWsgpru+rrh+\n u6vhAZffKBSh3ntJdpQHFiD0VroJIb/1rCMkeH11ycEHTiDzQ3GHBYQNUFEI/67zz/jVl8\n JMTdycS49gTRm0dFMuBeV8BBa7Tv99w=", "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776972035;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=9+dWxIjEbtZWJM6lJ1p1SMQ30hrcIj1G1U4aBy3qzDI=;\n b=trog1vFoWLnLJRghEK47xStnTzIrsQqMU1G6xOHRUWAnshA50vnHlpy7jkw6YbM/w5ZWle\n bF3DEZlSzK9pYKDQ==" ], "From": "Fabiano Rosas <farosas@suse.de>", "To": "qemu-devel@nongnu.org", "Cc": "Peter Xu <peterx@redhat.com>,\n\tTrieu Huynh <vikingtc4@gmail.com>", "Subject": "[PULL 23/43] migration: fix QIOChannelFile leak on error in\n file_connect_outgoing", "Date": "Thu, 23 Apr 2026 16:19:37 -0300", "Message-ID": "<20260423191958.1440-24-farosas@suse.de>", "X-Mailer": "git-send-email 2.51.0", "In-Reply-To": "<20260423191958.1440-1-farosas@suse.de>", "References": "<20260423191958.1440-1-farosas@suse.de>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Spam-Score": "-2.80", "X-Spamd-Result": "default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[];\n R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000];\n MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[];\n FREEMAIL_CC(0.00)[redhat.com,gmail.com]; TO_DN_SOME(0.00)[];\n MIME_TRACE(0.00)[0:+];\n DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[];\n RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[];\n FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_THREE(0.00)[3];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n FREEMAIL_ENVRCPT(0.00)[gmail.com]", "Received-SPF": "pass client-ip=2a07:de40:b251:101:10:150:64:2;\n envelope-from=farosas@suse.de; helo=smtp-out2.suse.de", "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, SPF_HELO_NONE=0.001,\n 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", "Precedence": "list", "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": "From: Trieu Huynh <vikingtc4@gmail.com>\n\nCommit 03a680c978 changed g_autoptr(QIOChannelFile) to a plain pointer\nbut failed to restore the necessary object_unref() calls on error paths.\nPreviously, these were handled implicitly by the g_autoptr cleanup\nmechanism.\n\nTwo error paths currently leak the QIOChannelFile object and its\nunderlying file descriptor:\n\n 1. When ftruncate() fails (e.g., on character or block devices).\n 2. When qio_channel_io_seek() fails after the channel is created.\n\nIn environments that retry migration automatically (e.g., libvirt),\nthese FDs accumulate until QEMU hits RLIMIT_NOFILE and fails with\nEMFILE (Too many open files).\n\nAdd the missing object_unref() calls to both error paths to ensure\nresources are properly released.\n\nSigned-off-by: Trieu Huynh <vikingtc4@gmail.com>\nReviewed-by: Peter Xu <peterx@redhat.com>\nLink: https://lore.kernel.org/qemu-devel/20260328121215.159532-1-vikingtc4@gmail.com\nSigned-off-by: Fabiano Rosas <farosas@suse.de>\n---\n migration/file.c | 2 ++\n tests/qtest/migration/file-tests.c | 48 ++++++++++++++++++++++++++++++\n 2 files changed, 50 insertions(+)", "diff": "diff --git a/migration/file.c b/migration/file.c\nindex 5618aced49..962b4b3a1b 100644\n--- a/migration/file.c\n+++ b/migration/file.c\n@@ -112,6 +112,7 @@ QIOChannel *file_connect_outgoing(MigrationState *s,\n error_setg_errno(errp, errno,\n \"failed to truncate migration file to offset %\" PRIx64,\n offset);\n+ object_unref(OBJECT(fioc));\n goto out;\n }\n \n@@ -119,6 +120,7 @@ QIOChannel *file_connect_outgoing(MigrationState *s,\n \n ioc = QIO_CHANNEL(fioc);\n if (offset && qio_channel_io_seek(ioc, offset, SEEK_SET, errp) < 0) {\n+ object_unref(OBJECT(fioc));\n ioc = NULL;\n goto out;\n }\ndiff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/file-tests.c\nindex 5d1b861cf6..fef172068f 100644\n--- a/tests/qtest/migration/file-tests.c\n+++ b/tests/qtest/migration/file-tests.c\n@@ -20,6 +20,51 @@\n \n static char *tmpfs;\n \n+static int count_proc_fds(pid_t pid)\n+{\n+ g_autofree char *fddir = g_strdup_printf(\"/proc/%d/fd\", (int)pid);\n+ GDir *dir = g_dir_open(fddir, 0, NULL);\n+ int count = 0;\n+\n+ if (!dir) {\n+ return -1;\n+ }\n+ while (g_dir_read_name(dir)) {\n+ count++;\n+ }\n+ g_dir_close(dir);\n+ return count;\n+}\n+\n+static void test_file_connect_outgoing_fd_leak(char *name, MigrateCommon *args)\n+{\n+ QTestState *from, *to;\n+ int fd_before, fd_after;\n+ const int retries = 5;\n+ int i;\n+ if (!g_file_test(\"/dev/full\", G_FILE_TEST_EXISTS)) {\n+ g_test_skip(\"/dev/full not available\");\n+ return;\n+ }\n+\n+ args->listen_uri = \"defer\";\n+ if (migrate_start(&from, &to, args->listen_uri, &args->start)) {\n+ return;\n+ }\n+\n+ fd_before = count_proc_fds(qtest_pid(from));\n+ g_assert_cmpint(fd_before, >, 0);\n+ for (i = 0; i < retries; i++) {\n+ migrate_qmp_fail(from, \"file:/dev/full\", NULL, \"{}\");\n+ migration_event_wait(from, \"failed\");\n+ }\n+\n+ fd_after = count_proc_fds(qtest_pid(from));\n+ g_assert_cmpint(fd_after, >, 0);\n+ g_assert_cmpint(fd_after, ==, fd_before);\n+ migrate_end(from, to, false);\n+}\n+\n static void test_precopy_file(char *name, MigrateCommon *args)\n {\n g_autofree char *uri = g_strdup_printf(\"file:%s/%s\", tmpfs,\n@@ -314,6 +359,9 @@ void migration_test_add_file(MigrationTestEnv *env)\n migration_test_add(\"/migration/precopy/file/offset/bad\",\n test_precopy_file_offset_bad);\n \n+ migration_test_add(\"/migration/precopy/file/connect-outgoing-fd-leak\",\n+ test_file_connect_outgoing_fd_leak);\n+\n migration_test_add(\"/migration/precopy/file/mapped-ram\",\n test_precopy_file_mapped_ram);\n migration_test_add(\"/migration/precopy/file/mapped-ram/live\",\n", "prefixes": [ "PULL", "23/43" ] }