From nobody Mon Nov 09 03:14:22 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jNFHy3x69z70S7W for ; Mon, 09 Nov 2026 03:14:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jNFHy0Vr8z3GMZ for ; Mon, 09 Nov 2026 03:14:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794194062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2sMvs/z30C+8bKhM2zax82VEJBS7b2BKygTOXzN3XYU=; b=wmXaBmBTWITFlxuOUFRBw21EYLYNPbeeICcW7BgnvOZ/Co5k1SsrZiYyFPrK/rVL1qabWn Vjnohs21MsVmiaZB67Tj72EQnPvYcW437SflrbDjbOFcBVMbgnFN8d9AeOp/CPJwthjouW klcHAIv1+2P8uOslTL9rnCu76/nVValBpu8kvQozwu6VvXUlo8DY4yiVDMW0a1i6pg8p9w TmpFNuiCGm40o25b9FgUy2WNJQv1H402TkSbDjvW/q/40oyZF8OLm+p7H8aiKmvjTlZHqq DRyN27p+SFiWL6Pn3v9LYMGiMZjKw3xVLdT0VJ2HlDmOK+BXQxGALgx8XhQjdg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794194062; b=VOknH3pOlQIsO5tnUbuOxmi/3qcDiu0xtcY5Q5OI+NglTXeUee4AjDutiBpCT5/kQdc3FI IPo99JgbnvDXDKHP9jqbB4R23Yt9hIZCZ2Dnb3WQZlptVit8rMaCPZy/iX16fSpJn5eJme THbdbdsaizTdf2/NxCJF5YPKYIqNvkIdjvlNF+n4Oec7G4n8sSsbb/L5VAunrVmYXwXqbA sfHc1f8tcYccqiV2HqIODyrfuAZHKOjK0didxiBwmRX7+uK2sbvjSDfE8VXwveO2hF+Bzi QuiKvwjNVgDrM+AdCH9FQvSXnrpDyN8JXi/hx74s70xdQmeNlCo0orwdHd92Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794194062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2sMvs/z30C+8bKhM2zax82VEJBS7b2BKygTOXzN3XYU=; b=yg1yL39Hhvk1TM10ctDtuY0uQSmvYykr67Sejo/shzZKQBngADL1zCS/QTpxm0EbobhEMN 3Sxz1yZxOSYTU/vmJ87Rf1eUgKJGEFYLtQtZEZ/EFnZnlSZRzvA4lWyVhUoUmL2TSmIAcQ rcC7Ymaki/oq3Ivy94I/EgRUlFyE2cT9OxXN4TyJSxCJgeXg0EbWhWU4MWQbusl8s/WXp+ 6/5iy5hZgKI8W0SBkx9GaOL1ZpClIRRoZ5eE5wMsBhZU/kNy+yP4XkumLjw1ACV1dZIHUi 3M3Rv/PLqKwlLWWfQxRPJqln+c/LGO+536Lfw2fqc0URhnxFa95tIaeK5EVGyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jNFHy07BPzKwx for ; Mon, 09 Nov 2026 03:14:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 10b88 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 09 Nov 2026 03:14:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 41aa43fd5ad1 - stable/14 - virtio_random: avoid using vtrnd_detach in the failure path List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 41aa43fd5ad1d8b0c8b7e17a6e419279e8e5ddaa Auto-Submitted: auto-generated Date: Mon, 09 Nov 2026 03:14:22 +0000 Message-Id: <6af13a8e.10b88.37a4d024@gitrepo.freebsd.org> The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=41aa43fd5ad1d8b0c8b7e17a6e419279e8e5ddaa commit 41aa43fd5ad1d8b0c8b7e17a6e419279e8e5ddaa Author: Kyle Evans AuthorDate: 2026-11-04 21:31:31 +0000 Commit: Kyle Evans CommitDate: 2026-11-09 03:14:11 +0000 virtio_random: avoid using vtrnd_detach in the failure path On the off chance that we discover more than one virtio-random device, the second one will deregister the global instance or trip an invariant when it fails to attach and calls vtrnd_detach(). We don't have that many resources to free, so just inline those. This is purely a hygiene thing, we haven't seen an instance of this in the wild (to my knowledge). Reviewed by: bnovkov, kfv Sponsored by: Stormshield Sponsored by: Klara, Inc. (cherry picked from commit 26ba71f73e8914ecd9e5b1e7bb864fee41158d04) --- sys/dev/virtio/random/virtio_random.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/dev/virtio/random/virtio_random.c b/sys/dev/virtio/random/virtio_random.c index 4a661ad0c19d..86c8b52444ec 100644 --- a/sys/dev/virtio/random/virtio_random.c +++ b/sys/dev/virtio/random/virtio_random.c @@ -185,8 +185,15 @@ vtrnd_attach(device_t dev) vtrnd_enqueue(sc); fail: - if (error) - vtrnd_detach(dev); + if (error != 0) { + /* Parent will free the virtqueue. */ + if (g_vtrnd_softc == sc) { + atomic_store_explicit(&g_vtrnd_softc, NULL, + memory_order_release); + } + sglist_free(sc->vtrnd_sg); + zfree(sc->vtrnd_value, M_DEVBUF); + } return (error); }