From nobody Sat Jun 20 18:16:54 2026 X-Original-To: dev-commits-src-main@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 4gjN2t6ksPz6hGwq for ; Sat, 20 Jun 2026 18:16:54 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gjN2t4LCtz3kQg for ; Sat, 20 Jun 2026 18:16:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781979414; 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=5Xrq+MMJ+mLcRBHNqBSsUZo38PBpl+pOKT+GgmZ820g=; b=C+FC+an4faPwfR8TtPYQZuNN/lX8x9Btvyxz8kMZGeloEAK8TClTl7DXzBCkRdGXKW+26c HJKXTqemldtQA5zH0LFBz5247y+g89/lrofBXK02SjuYafgl2y4AH02P999w3wUjv2ygpD AKklfwN6OP2mUdqD8Y9F1w/VmQ37O5sMfv6KcFUU81cDflIpVHupAr71HjD9NaeaJ6nxtk jEbpIMfvgXiM72ViP8QuM/1Bji5kUjE7CUl3iMAY7n4HxvYhiSvTp1p0j5niXNDmypXflg p+xLlOERPAxqXg4XAF0fiG1ZhviTYibOf5CTy45gdMAx2/Wa477tKZfUGd5Tlg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781979414; a=rsa-sha256; cv=none; b=eHb6e3H1g6HXUuk0riidKymxmp/SH5UzjlQo3k6Ceh9Hkrx+WFZ93tewJ28omcnVAqyPq7 h7NbsbUhNLvqSS9Cia/ub3I0MWsCsKcxxyqx6fvq8NU0f34og1DQOGFTHf7nNByCG+5l04 i13QSDa/O/VD5yRCsh4M6/G5j6q3K0Scs4+mIaby2SKIqOEkUnPv8xMDAHyycreoKnIMYN EkUrsrUQgMuHAp9O22IEWCYd/Htd3nwsuoOSt2VzeIxs6Y0TJSY5LfK/tjk0JQhij9LvXx TKtsM6iP5hnjjgkvMnxMtRluqojDYusRiwEykmFmw9FY8E85n05lpsHTwGGHLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781979414; 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=5Xrq+MMJ+mLcRBHNqBSsUZo38PBpl+pOKT+GgmZ820g=; b=ULQnO9d8h5NF+KhfiHGS3fyNi4IlqaKdd9IG74aMtOVOkKatbT/AVIZsLuDvVHK3WW1Ehq u3JkcWakx43KWUXGOo7JL5nrcZ12c0bR8vgo0Zp8/Gab34IO+NtLyuEwFHINQQYX1VZXhn 6BZ28grqPRZbvnK5k4LuXb+UOxSwRQYvTdiaW8vi0YfXrMesf+RGDHTSBL20Khm2ZT73T4 s/2/Qpw/4slsN74BK4wfVgvLW4p151Xq7MT2kTmC+qaS3ReVbeQ9N/GoueU5txEpx4P2m4 v9DNT5x4AGjeeLD1kr8W73ZssTcUMgxXaK/7KNqJ8Jz8fZ842ELMieTASm2VPA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gjN2t369nzhmk for ; Sat, 20 Jun 2026 18:16:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25be0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 20 Jun 2026 18:16:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 8edcb37dd075 - main - efirt(9): carefully destroy efi_lock List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8edcb37dd0753dc7e50044d9ccf0e991392a3d84 Auto-Submitted: auto-generated Date: Sat, 20 Jun 2026 18:16:54 +0000 Message-Id: <6a36d916.25be0.681263a9@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8edcb37dd0753dc7e50044d9ccf0e991392a3d84 commit 8edcb37dd0753dc7e50044d9ccf0e991392a3d84 Author: Konstantin Belousov AuthorDate: 2026-06-20 12:20:38 +0000 Commit: Konstantin Belousov CommitDate: 2026-06-20 18:16:37 +0000 efirt(9): carefully destroy efi_lock efi_init() might return error after initializing the mutex, in which case MOD_UNLOAD() is not processed, and the mutex is not destroyed. Similarly, efi_uninit() skips any processing if efi_runtime was left as NULL, leaving mutex not destroyed. Initialize the mutex in MOD_LOAD case, and destroy in MOD_UNLOAD, also handling errors. Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57704 --- sys/dev/efidev/efirt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c index 2e9a917de1f0..590d98030741 100644 --- a/sys/dev/efidev/efirt.c +++ b/sys/dev/efidev/efirt.c @@ -29,7 +29,6 @@ * SUCH DAMAGE. */ -#include #include "opt_acpi.h" #include @@ -184,7 +183,6 @@ efi_init(void) TUNABLE_INT_FETCH("efi.rt.disabled", &rt_disabled); if (rt_disabled == 1) return (0); - mtx_init(&efi_lock, "efi", NULL, MTX_DEF); if (efi_systbl_phys == 0) { if (bootverbose) @@ -285,8 +283,6 @@ efi_uninit(void) efi_systbl = NULL; efi_cfgtbl = NULL; efi_runtime = NULL; - - mtx_destroy(&efi_lock); } static int @@ -858,13 +854,19 @@ const struct efi_ops *active_efi_ops = &efi_ops; static int efirt_modevents(module_t m, int event, void *arg __unused) { + int error; switch (event) { case MOD_LOAD: - return (efi_init()); + mtx_init(&efi_lock, "efi", NULL, MTX_DEF); + error = efi_init(); + if (error != 0) + mtx_destroy(&efi_lock); + return (error); case MOD_UNLOAD: efi_uninit(); + mtx_destroy(&efi_lock); return (0); case MOD_SHUTDOWN: