From nobody Mon Nov 23 22:28:44 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794227018; b=cU/EhA9AP5Z47WHSYKAdzIdZEYVDSb4mrTO2OvY9NqteE1X9GDykhjHrSB+AAsIx8Cpk tPh2sJz2t7McpekzT6ZJNMvRGhrQDPMzzFsZol3701pgwpDcAwTuZwRHAZVYxZaVB14Cr cQ5EXzAoJsDWgtVsmJNuxA66iY/tF3/DaHowCd8N65MMv4X6y0YOEGOpkxdxLEFL9MnwT V1MKsHzbXdAC+S4/0I5OeyZ+Zjkevmx+sC/sq2ky/LuxNAi6nipzKRGZbPCd7bU68rH2e V72qpR59ErR7xf3Cm4eeolQxY6tt0kqkmjd2VGJToSN9O7ENpgqN+EYueuLnoNfboFg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794227018; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=1vcgV08xYKH0g5nt/nWVsU3QDB7VewTUh+uDf63N1EY=; b=upd24YnZl5LEJDWZvs3qr2l0WcwKImC0u5uSnwv6E4Tb6lWB47fvNsRuwKM8EAnF6rGF /H1gT99yyRFm9fWfFLUJesVxQJQrL4qLyCM/854N+DEjYCTSlVDIbZLeAmo1jvUSmOtgu 0gGAA6cfzb/Xk8GAnGgSfT2xkG+irqxUB6MDKH31nLj/7CSHruHNRRCtgDsCY/acvm54m VRTSwz0CfbEzjJWc3KX1gBWSiTriBAXAxQPIBRsb+s+LPzHtPEYSL+q5OIr93hYauoTtJ y2kmkyrpcbGHfF4vowJIpAHqEGvH3Wq0OnVY6o+XWoDDdhUhnUJCK35fA+sZfVBzZHg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail header.from=isslab.korea.ac.kr; spf=none smtp.mailfrom=isslab.korea.ac.kr; dkim=pass header.d=isslab-korea-ac-kr.20260707.gappssmtp.com header.i=@isslab-korea-ac-kr.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=HMtX0kqP; arc=none smtp.remote-ip=209.85.216.50 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AFC1606EE87 for ; Mon, 9 Nov 2026 12:23:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4AFC1606EE87 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=isslab.korea.ac.kr Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=isslab.korea.ac.kr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=isslab-korea-ac-kr.20260707.gappssmtp.com header.i=@isslab-korea-ac-kr.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=HMtX0kqP Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-3b15e46698aso29965a91.3 for ; Mon, 09 Nov 2026 04:23:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=isslab-korea-ac-kr.20260707.gappssmtp.com; s=20260707; t=1794227016; x=1794831816; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1vcgV08xYKH0g5nt/nWVsU3QDB7VewTUh+uDf63N1EY=; b=HMtX0kqPqMoObLm9xbSY5r+aq9P0sgd+ui3pyyjnbdQ1j9/nRh1x+eDWY3EToJih0K BiFAvv02SNpv1Wp764o8vLlkwQwXNRmkdj5qj2fOTgFJPV86UIkD98sCBYAN17vmfxDX pXBde7BbgysjYt/JYSKHegqG9MkBlQpB/KqtSpo4U6UQYLK13KaIf/Oa23XjzrZQSG5r N0jyAPJnOpBX1ZwugQAdgnEKKDLMoawu16dsMlnyUotTErp2d65cXj9f1AAAhh0ghpOO ocrjKFoajYJymt8iIo9UDvXjzx2dWgW0b2uFebTukhI5PShE7LAtlLqCD0g2fTfJSOlm nNAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794227016; x=1794831816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=1vcgV08xYKH0g5nt/nWVsU3QDB7VewTUh+uDf63N1EY=; b=vU6QVv/ddRGH6F6igxM+E4g7vpQZKyLkhYrE6KJD6umWVl0boBAsgk92KF8G7LSKul h2arSz2ZxQU1kzQkkAYaqkSJ7cCFEHrG3Op0VyeCyohj5LdE8tGQuo5gEB7qxTutu/sF zzaDhoyL2rYPgHnF8Eekl/ejJ2rQqKXKlmOPxlyzKK5KGG2ZC0ftCx86Kr/bChUWjCZL vbUzR/gqUS4ZkDiOks4hIF1LAOS/R6IOTNwz9xkIvhYVOtgl/sTuxY0VeRThP9AbfHkD 6huYU/jzFb50pIUXqoaQ4Nvn/Z6XeU6lfEduomK7118Fe0q9V6V7RsbtxK3Q+PyKoEhm tpdg== X-Forwarded-Encrypted: i=1; AL+hErEotTgvUcxHxhZ5afu+WZvk+QSumXt1u/hqS7vKHhpHduwfvkyvNFAO2Rm/E3SV7grUX11HlwHFFuhey3g=@vger.kernel.org X-Gm-Message-State: APuU4Z+WZNLT6iQjIY9KcAu3ppB5dgzYrc/U3Ot7Olxu5asy9rh+RI0T HlPZdc6CHBqd9/a4qQ18QnV6Gk2k4yszE4GgKlP7ffo0NdiqctxNfxJoAXNkJIFDWfI= X-Gm-Gg: AYBFou3tW3CEzvYygt+8NUJcwh1ul9FPvcXlJMLo90026veutUIz8kjV13dbfqEFVwG grgCaW4QpUlTDYlrk3ycHBBoFxziraWAa+0rSI0PMGHEidZdkMsbOWgsB2ig9VBq0GXb3e1GD03 YDHEpKSjqeEQ3v7LmzOZ0ppmsBaJPRfYjxcLVCBz0gwfOPIK67PBqy9086izLtcbpu4LmGnvm4J ppK1KzblXCupqGklMFyfJ6GJyZnnFpLzqG6BR+48WKgZm0L/lEgaGL4GlGZbpbpP12eTwWMNJ3D V0nvlWDEKE5ATatnhmf8+iPwJrDGukZUhX8JKiDICDRUlqeQvp60Wi3m38NmB/zx4wlmmC27ag9 3+5DmP9O/36H3x5ZC/tNP+M4oD+clYYJjr/l1uTjBhN0Kn3Lg9vjKYUUq0PVQVvSYAtXASr0GQC 0/9JgkzfkagcAsowNzJ1qRAxwS3Wgp5015WRvnRpnV8PMYlTxF3gZGHzYjDm0s2d3FBUZYT5PLL nDsyR7QnJXMAP/M7tbzWmHJX7133ThoQQAWCmySN4Bgt+Jm9FPUVoG6rubbkOxRhoMy04zfOygD 7pDrz6fGllQXOZI+b2dym5Kry6MrndZ8b+E8zebuKbabnLRZS3xF1tdVGXClgKWFUVKwCLzn9v1 Inil9BmMLXYgJOY8EA486d2RueLYaZM2TGFJNfQ== X-Received: by 2002:a17:90b:5285:b0:3ac:7c52:fb04 with SMTP id 98e67ed59e1d1-3b12d43b32dmr3413278a91.44.1794227016472; Mon, 09 Nov 2026 04:23:36 -0800 (PST) Received: from yhlee-960QFG.Davolink ([2406:5900:1044:110c:3d70:1891:1a66:b169]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b127912d62sm6836905a91.11.2026.11.09.04.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2026 04:23:36 -0800 (PST) From: Yehyeong Lee To: jgross@suse.com, sstabellini@kernel.org Cc: oleksandr_tyshchenko@epam.com, boris.ostrovsky@oracle.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 1/2] xen/pvcalls: unwind pvcalls_new_active_socket() step by step Date: Mon, 9 Nov 2026 21:23:23 +0900 Message-ID: <20261109122324.30134-2-yhlee@isslab.korea.ac.kr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261109122324.30134-1-yhlee@isslab.korea.ac.kr> References: <20261109122324.30134-1-yhlee@isslab.korea.ac.kr> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Every error path in pvcalls_new_active_socket() jumps to one shared label that does list_del(&map->list) and then hands map to pvcalls_back_release_active(). But map comes from kzalloc() and its list_head is only published at the very end of the function, after the last of those jumps: down(&fedata->socket_lock); list_add_tail(&map->list, &fedata->socket_mappings); up(&fedata->socket_lock); so on the error path map->list is still {NULL, NULL} and __list_del() writes through a NULL pointer. A frontend gets there with one value it owns: the ring_order field of the page it granted. Anything above MAX_RING_ORDER takes the second goto, and nothing else in the function has run by then. The result is an oops in whichever context handled the request - the pvcalls-back threaded IRQ handler for PVCALLS_CONNECT, mappass->wq for PVCALLS_ACCEPT - and because it happens after down(&fedata->socket_lock) that semaphore is never released, so every later operation on the frontend blocks on it and the backend never completes backend_disconnect(). (With CONFIG_DEBUG_LIST the list_del() only reports and returns, and pvcalls_back_release_active() then runs on a map whose irq is still 0 and whose bytes, ioworker.wq and saved_data_ready are all NULL.) A frontend asking for ring_order 5, on a dom0 built with KASAN (the request was issued by a test-only change to the frontend): [ 133.728877] pvcalls_new_active_socket frontend requested ring_order 5, w= hich is > MAX (4) [ 133.732868] Oops: general protection fault, probably for non-canonical a= ddress 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI [ 133.737910] KASAN: null-ptr-deref in range [0x0000000000000008-0x0000000= 00000000f] [ 133.741666] CPU: 0 UID: 0 PID: 133 Comm: irq/39-pvcalls- Not tainted 7.3= .0-kCTLblk2-15482-g21a7f44fd076-dirty #1 PREEMPT(full) [ 133.746986] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.1= 6.3-debian-1.16.3-2 04/01/2014 [ 133.751512] RIP: 0010:pvcalls_new_active_socket+0x821/0xb90 [ 133.754237] Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 f6 01 00 00 48 = 8d 79 08 4c 8b 6b 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80= > 3c 02 00 0f 85 14 02 00 00 4c 89 ea 4c 89 69 08 48 b8 00 00 00 [ 133.763126] RSP: 0018:ffffc900004afb38 EFLAGS: 00010202 [ 133.765861] RAX: dffffc0000000000 RBX: ffff88810886c900 RCX: 00000000000= 00000 [ 133.769348] RDX: 0000000000000001 RSI: 0000000000000246 RDI: 00000000000= 00008 [ 133.772787] RBP: 1ffff92000095f6b R08: 0000000000000001 R09: fffff520000= 95f58 [ 133.776260] R10: 0000000000000003 R11: ffff888100077320 R12: ffff8881085= 8b410 [ 133.779823] R13: 0000000000000000 R14: ffff88810858b460 R15: ffff8881085= 8b400 [ 133.783382] FS: 0000000000000000(0000) GS:ffff8881b034c000(0000) knlGS:= 0000000000000000 [ 133.787351] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 133.790308] CR2: 00000000006042c0 CR3: 0000000108400001 CR4: 00000000007= 70ef0 [ 133.793822] PKRU: 55555554 [ 133.795347] Call Trace: [ 133.796778] [ 133.798082] ? __pfx_pvcalls_new_active_socket+0x10/0x10 [ 133.800801] ? security_socket_post_create+0x4d/0x60 [ 133.803275] ? release_sock+0x1a/0x1d0 [ 133.805182] pvcalls_back_event+0x1b09/0x23e0 [ 133.807431] ? __pfx_pvcalls_back_event+0x10/0x10 [ 133.809814] ? __pfx__raw_spin_lock_irqsave+0x10/0x10 [ 133.812251] ? __pfx_pvcalls_back_event+0x10/0x10 [ 133.814554] irq_thread_fn+0x86/0x150 [ 133.816468] irq_thread+0x2da/0x580 [ 133.818363] ? __pfx_irq_thread_fn+0x10/0x10 [ 133.820586] ? __pfx_irq_thread+0x10/0x10 [ 133.822670] ? __kthread_parkme+0x88/0x170 [ 133.824803] ? __pfx_irq_thread+0x10/0x10 [ 133.827153] ? __pfx_irq_thread+0x10/0x10 [ 133.829304] kthread+0x2c8/0x3b0 [ 133.831176] ? recalc_sigpending+0x15c/0x1e0 [ 133.833570] ? __pfx_kthread+0x10/0x10 [ 133.835572] ret_from_fork+0x373/0x5b0 [ 133.837581] ? __pfx_ret_from_fork+0x10/0x10 [ 133.839978] ? __switch_to+0x3c4/0xb40 [ 133.841984] ? __pfx_kthread+0x10/0x10 [ 133.843970] ret_from_fork_asm+0x1a/0x30 [ 133.846031] [ 133.847420] Modules linked in: [ 133.849240] ---[ end trace 0000000000000000 ]--- Give each failure its own label, so that only resources that were actually acquired are released and the list the map was never added to is left alone. The map is not published anywhere at that point, so the error path needs no socket_lock at all. sock_release() stays in the callee on every error path, the way commit 8fafac202d18 ("xen/pvcalls-back: fix double frees with pvcalls_new_a= ctive_socket()") arranged it. Fixes: 5db4d286a8ef ("xen/pvcalls: implement connect command") Cc: stable@vger.kernel.org Signed-off-by: Yehyeong Lee Reviewed-by: Stefano Stabellini --- drivers/xen/pvcalls-back.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c index ba62651a7f338b..dcefa91a40cd05 100644 --- a/drivers/xen/pvcalls-back.c +++ b/drivers/xen/pvcalls-back.c @@ -337,7 +337,7 @@ static struct sock_mapping *pvcalls_new_active_socket( =20 ret =3D xenbus_map_ring_valloc(fedata->dev, &ref, 1, &page); if (ret < 0) - goto out; + goto out_map; map->ring =3D page; map->ring_order =3D map->ring->ring_order; /* first read the order, then map the data ring */ @@ -345,19 +345,19 @@ static struct sock_mapping *pvcalls_new_active_socket( if (map->ring_order > MAX_RING_ORDER) { pr_warn("%s frontend requested ring_order %u, which is > MAX (%u)\n", __func__, map->ring_order, MAX_RING_ORDER); - goto out; + goto out_unmap_ring; } ret =3D xenbus_map_ring_valloc(fedata->dev, map->ring->ref, (1 << map->ring_order), &page); if (ret < 0) - goto out; + goto out_unmap_ring; map->bytes =3D page; =20 ret =3D bind_interdomain_evtchn_to_irqhandler_lateeoi( fedata->dev, evtchn, pvcalls_back_conn_event, 0, "pvcalls-backend", map); if (ret < 0) - goto out; + goto out_unmap_bytes; map->irq =3D ret; =20 map->data.in =3D map->bytes; @@ -365,7 +365,7 @@ static struct sock_mapping *pvcalls_new_active_socket( =20 map->ioworker.wq =3D alloc_ordered_workqueue("pvcalls_io", 0); if (!map->ioworker.wq) - goto out; + goto out_unbind; atomic_set(&map->io, 1); INIT_WORK(&map->ioworker.register_work, pvcalls_back_ioworker); =20 @@ -381,11 +381,16 @@ static struct sock_mapping *pvcalls_new_active_socket( write_unlock_bh(&map->sock->sk->sk_callback_lock); =20 return map; -out: - down(&fedata->socket_lock); - list_del(&map->list); - pvcalls_back_release_active(fedata->dev, fedata, map); - up(&fedata->socket_lock); + +out_unbind: + unbind_from_irqhandler(map->irq, map); +out_unmap_bytes: + xenbus_unmap_ring_vfree(fedata->dev, map->bytes); +out_unmap_ring: + xenbus_unmap_ring_vfree(fedata->dev, (void *)map->ring); +out_map: + sock_release(sock); + kfree(map); return NULL; } =20 --=20 2.43.0 From nobody Mon Nov 23 22:28:44 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794227019; b=XTWaKHMKxQHoYey1jrTp/86UZ57xpLsSb36kqcfTnQynFiCC4cUi1xj2tUKRqHRS5Pwl 10+kfwM5PUZ/dLhz31glRQzEPRca2WX8uFFj8g/7BnWJuhyopCFKjWI/2iw/JLw+zxfcm Kd5NpIgO0Mo8Emwz2UQj8ION1PkdREvuOw0GgBd1RS0ED73uvHKic+onFno4rDNHXFH6H 9ZP1ZXf/nU4mlUF6cmgAsh2Ue9iT8Txa+PDAlnv8deoRf7MwD0uzVbQbELectdZr2O+b1 xdbyGFVUquRZR2UqVAF9Mh3EZdukbRqqLJ+BgjPZGfEteQmBfojIPNDGxJQS+nkWsUQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794227019; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=MdOqoOEupQFbfi4QuNxY8pxCO+41UFytiQ7mtp1SJ10=; b=NZ0D7QUQgv6qZrpZTc2sQpc139iWPa8vNBzHgp8M//fQLRMPTnBq2xxFi4zkQ2izKD0+ s1VObUYlA0R3wmRtiTO3vX1nvKelMkPbdzYNwjCwkSAeh1XP+7vTqm0iFy8tspLws6Zvm zgTqCK66XvJBO9xD5Zrfa8pgV9Lbag/3MjnvtVIn2EXvbt44r/hlkHWpVs2Bxd0ySolZI g4JpcgKEVeD2ywOStVRvHb/FzU1owTPka2xtgjK/uIl0fwqnC/1TwLub/xsP1heHfwYRs 1OOYzVhVxJ6WNJLh6u/ZvFVw/NrGNIzZ+w7tgqEr3znAFly1s5aSnVIdTmqjuW5pwvA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail header.from=isslab.korea.ac.kr; spf=none smtp.mailfrom=isslab.korea.ac.kr; dkim=pass header.d=isslab-korea-ac-kr.20260707.gappssmtp.com header.i=@isslab-korea-ac-kr.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=STY0ySgF; arc=none smtp.remote-ip=209.85.216.43 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E5896082BC7 for ; Mon, 9 Nov 2026 12:23:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6E5896082BC7 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=isslab.korea.ac.kr Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=isslab.korea.ac.kr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=isslab-korea-ac-kr.20260707.gappssmtp.com header.i=@isslab-korea-ac-kr.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=STY0ySgF Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-3adac5c10e3so389547a91.0 for ; Mon, 09 Nov 2026 04:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=isslab-korea-ac-kr.20260707.gappssmtp.com; s=20260707; t=1794227019; x=1794831819; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MdOqoOEupQFbfi4QuNxY8pxCO+41UFytiQ7mtp1SJ10=; b=STY0ySgFQct71N6fSXFw7gPHNK9fh1uk/HKydCqbkruXIWcuy3S4z/jNdEXBQ4XwfU C9aFa47b4YtQtk9chb0ztOYkd4nntbwk2ATEiP33A9H2UR8HKwyg3OSWZfewrhyjS/qB QNHHUgkANKW4G+nH+kPJEBG661VnKBnrCLo9oM9MpCsh01oV+V20luewPyAnc/buVSVA 5GXrWnbP01TX1Z2vxaMlYC6vOY38ICJKs+vELMCLG+G1+PsGj8ru8tVz6ND3gF3f1G9o irgKd7nQxwHW8Uqy5uc+ihnMPuQHOS7e/9e9VYBrWiha4meZv/hlmxXlyXiIDBcxVufS 2JmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794227019; x=1794831819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=MdOqoOEupQFbfi4QuNxY8pxCO+41UFytiQ7mtp1SJ10=; b=VWCSAZ4dGp1rTnGKhiDmzc84FBMxd1te8rzosUQZVDIOysfchIPdj2cpTV/p1CpDCZ RNgsF0jUxeN1w97u7RemEuE/I6Iq9yEdRKh7596bJCjQ/S2il5qq8kq0GyqhZ8PBcNw6 lij5jYoNqacMqQu119S7jWIHgjqSn7WHc8dCjsEYy8MH8yqLPENurm60WS1CkduEK0rQ cVq1k3vWSgY4GSXnvY6R5XbmSzzSiLYWQ77+Vf/so5sUW3+0/cC7OxLTAsGxv+hNblSe lqfDOnkTpE6VfTTYrVRWkY8T3VFViHvldAioaKW9+w79PjsfoWJrStgJNJ0YTr4YJOMx pZag== X-Forwarded-Encrypted: i=1; AL+hErERxRTxvcMeVkW4SpeHwgZCba/BO2dDsU/kN+TVmKMB3MnHQl/Ot9GYVikb5xL6BE84lSK8OUF4go1NFp0=@vger.kernel.org X-Gm-Message-State: APuU4Z+rhwOanbdWP55acsw6+HRKKl1d6xgPFeciS2JgekfF5iHx3lqo KjL73iet4zvpZJdiUV0zV7nYYKcsKBZDpDxp+9zAgxDsKK7RRCnVXr5SePkXkYhm4Aw= X-Gm-Gg: AYBFou2EMxPc/hSx0AhyGKxYQ2TGfrK4/T/ZciBCYK69VefLYgoJZL204qdxLN98+Mc fuxbAYn+WgIVEG8BXzbx1rHsmidhVGpIbEYzf9cOutqpH5HsKRCfaFyYvRduleEHu2/js1DByym 7Lvm88SRRRzl5MC+mvWh19Nn/f2aMKOA3ahlPXgMMFrqMKqQNxsMjpj4LY1jxdf+7wet3QY2ujW 3dBj0rcVk265pD+6GiHpWYiolKOaB4sIpvB80TS6nNE5pUBNb3WLSACj0H+dOltC3kfbcLJgSkY rxhYDCGb4AniVNQJvFpXKRBa0HClcbDF2cbRiOzeYp9Wx0MvqjT/TTT/PV6/lC62WBfJlidcNWn TnGXRhGR99nhAULEuNjwrpUFgmJQihwcIuyK6Xv68/g7T/WXeXlj9t3Orl4h54aRWhgH9HVVeVQ YK9kjISfaNJNlH+/6iIQnkiOcmooavGoyGp+cjVSoUTgA+z9E76uBSfApRAgDf6rTZSj/vn6Hps FiwWZjqsLVSQMuXDDDjFCji3TyTJ9hX2Y7es4XlYCqvig1wnO/dtam4+J7x+k01zS8tj9KrPHhy 5jkzYmcVX3GYixl5fluMs6Pmr4gCzmhLOiIW4z3LdpWhLIEXK1ntlBGMPzsbG/WQ60FDo2F0+Me qpS3amufC5A7Fa1GoAdOehWA4jcGkTizxNTFkFQ== X-Received: by 2002:a17:90b:2547:b0:3ac:8af9:4a77 with SMTP id 98e67ed59e1d1-3b12d4204e3mr3448890a91.10.1794227018821; Mon, 09 Nov 2026 04:23:38 -0800 (PST) Received: from yhlee-960QFG.Davolink ([2406:5900:1044:110c:3d70:1891:1a66:b169]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b127912d62sm6836905a91.11.2026.11.09.04.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2026 04:23:38 -0800 (PST) From: Yehyeong Lee To: jgross@suse.com, sstabellini@kernel.org Cc: oleksandr_tyshchenko@epam.com, boris.ostrovsky@oracle.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 2/2] xen/pvcalls: destroy the per-socket workqueue on release Date: Mon, 9 Nov 2026 21:23:24 +0900 Message-ID: <20261109122324.30134-3-yhlee@isslab.korea.ac.kr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261109122324.30134-1-yhlee@isslab.korea.ac.kr> References: <20261109122324.30134-1-yhlee@isslab.korea.ac.kr> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pvcalls_new_active_socket() gives every active socket its own ordered workqueue: map->ioworker.wq =3D alloc_ordered_workqueue("pvcalls_io", 0); and nothing ever destroys it. pvcalls_back_release_active() flushes map->ioworker.register_work and frees map, but the workqueue and its pool_workqueues stay allocated, so a frontend leaks a workqueue per socket it connects and releases - a loop a guest can run as long as it likes. Destroy it after the IRQ is unbound, so no new work can be queued, and before map is freed. pvcalls_back_ioworker() takes no locks, in particular not fedata->socket_lock, which the backend_disconnect() caller holds here, so draining it from this point is safe; the flush_work() just above already has the same requirement. Fixes: 5db4d286a8ef ("xen/pvcalls: implement connect command") Cc: stable@vger.kernel.org Signed-off-by: Yehyeong Lee Reviewed-by: Stefano Stabellini --- drivers/xen/pvcalls-back.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c index dcefa91a40cd05..27aa06289a7b92 100644 --- a/drivers/xen/pvcalls-back.c +++ b/drivers/xen/pvcalls-back.c @@ -456,6 +456,7 @@ static int pvcalls_back_release_active(struct xenbus_de= vice *dev, xenbus_unmap_ring_vfree(dev, map->bytes); xenbus_unmap_ring_vfree(dev, (void *)map->ring); unbind_from_irqhandler(map->irq, map); + destroy_workqueue(map->ioworker.wq); =20 sock_release(map->sock); kfree(map); --=20 2.43.0