From nobody Wed Oct 07 18:24:50 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 4j0M3k2DPNz4n6t7 for ; Wed, 07 Oct 2026 18:24:50 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j0M3k1dKrz4qff for ; Wed, 07 Oct 2026 18:24:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791397490; 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=bUm1LNwFV8wV+9Rsi1Aih9ftzodSilh/oukTXXCLD+M=; b=MbBX8jw3YtkX5XjZ0lZu95zRQzccB96fC+me3OUFZhlVqO3yixGpZynCcojXosFthvInB4 b8IOXCVLC98Pf++9vDCarBwBZJrKSrc77xCUuAJtTerqwk9yBks/45rrllPPSoBaU6rNV+ rrvtPoCd6LAoD3JKCGw6rAdtfrOUYC57/6FyUEJg5TdTOekYYqCo0es75/4i8M3xNbGybW luxLzsXFlaONT885BH25UYDiIAYdlMs7/ZAG/JEdLB5T69Hni8y+hran5YDv+vQSATCN/a TWyigTz6T+ahkAiNB1ZYGdhRgm6FlF4gxgaX+XORW9DUXcSdIz9n3xvDSb/axQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791397490; b=xM3gabcNI2EDIYVjQz1TMeeszHoCFpijsCCEIyDfQ6/sa9O21AmGVzbQJR0dpSsUFW/1dQ Jxzo2SkHK6AzS87cbmZ/ITbsw4b/i0cooB2kQphsx0esNWw8Oh5hyS6TUGKdn9op8C5muJ pW3ttcGgc7CuMuh12i3ZYSi4f5BSkrdcTvbO2RA2G/aBw9/CM8+GW4/ncKRnKUyApB9P93 N6r1eyBm4niKMDktQBiGY3Ih0QEa98kS+BqgTDezqARB+LQbFncE9W+D9G1K7o669AQlCm fwauiGYGLyj1SdDrw3Ed6PykcNz2tP9lrpxSqAA9V0+29cjhP5O1/nDHblBdOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791397490; 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=bUm1LNwFV8wV+9Rsi1Aih9ftzodSilh/oukTXXCLD+M=; b=MDF2eKOh7OLckmp6hHqL7berasq656CzSmoiTjwWX1RAoeuzRzap32YKs0SRK2uOT0L6dL 0hbmeCcu6mB7Ah4VqnfkJdAtbwSmCIJsKBo85IbrEPVhGfO1eGO12FSqfZUeXqOClmUzo4 HNYEUle9IuTIfgxlQLOtomsa6Sm/YBG+LNNvBWHU3MYG0z31lEgbOaqJJTt6r13gO7vB/x 5qQ9ZJEo3MyXv1HFCoAxXwfwnkqTuY9Uj0JCEt5wMYaWRCh47+XqdQGzf6A56MYHnXrnvH 0yX2KADVhUTcUoT33xvMfzoEiA9T8HbWvqXn5MIiMcqp2qZzGXwyy8bV2u2E0w== 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 4j0M3k0NNdz14LK for ; Wed, 07 Oct 2026 18:24:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ecb0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 07 Oct 2026 18:24:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Enji Cooper Subject: git: ef947bb97302 - main - LinuxKPI: firmware: remove `enoentok` logic in `*firmware_request(..)` 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: ngie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef947bb97302d8862545cd0a5f38b24fa1bae2f6 Auto-Submitted: auto-generated Date: Wed, 07 Oct 2026 18:24:50 +0000 Message-Id: <6ac68e72.3ecb0.63fb9cf8@gitrepo.freebsd.org> The branch main has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=ef947bb97302d8862545cd0a5f38b24fa1bae2f6 commit ef947bb97302d8862545cd0a5f38b24fa1bae2f6 Author: Enji Cooper AuthorDate: 2026-10-07 18:22:00 +0000 Commit: Enji Cooper CommitDate: 2026-10-07 18:22:12 +0000 LinuxKPI: firmware: remove `enoentok` logic in `*firmware_request(..)` Prior to this change, in the event that a firmware module could not be loaded, the linux_firmware driver would return a partially initialized structure with uninitialized/zeroed out values for certain fields. Linux does not do this, however, so some drivers that use `request_firmware_nowait` expecting Linux behavior, like `if_bcrmfmac`, would crash trying to dereference a NULL pointer. This doesn't address the load/unload situation completely as the driver remains loaded after the "firmware crashes", but it makes a completely unusable situation (a kernel panic) into a slightly more usable situation (driver does not unload). As a sidenote: the raw free(9) call was replaced with a call to `linuxkpi_release_firmware` because the latter call [better] ensures that all resources allocated earlier on in the function are cleaned up. MFC after: 1 weeks Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D58451 --- sys/compat/linuxkpi/common/src/linux_firmware.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c index 0915b317c01e..0d8f9b770d70 100644 --- a/sys/compat/linuxkpi/common/src/linux_firmware.c +++ b/sys/compat/linuxkpi/common/src/linux_firmware.c @@ -57,7 +57,7 @@ struct lkpi_fw_task { static int _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware **fw, - struct device *dev, gfp_t gfp __unused, bool enoentok, bool warn) + struct device *dev, gfp_t gfp __unused, bool warn) { const struct firmware *fbdfw; struct linuxkpi_firmware *lfw; @@ -124,12 +124,8 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware * } } if (fbdfw == NULL) { - if (enoentok) - *fw = lfw; - else { - free(lfw, M_LKPI_FW); - *fw = NULL; - } + linuxkpi_release_firmware(lfw); + *fw = NULL; if (warn) device_printf(dev->bsddev, "could not load firmware image '%s'\n", @@ -159,8 +155,8 @@ lkpi_fw_task(void *ctx, int pending) if (lfwt->cont == NULL) goto out; - _linuxkpi_request_firmware(lfwt->fw_name, &fw, lfwt->dev, - lfwt->gfp, true, true); + _linuxkpi_request_firmware(lfwt->fw_name, &fw, lfwt->dev, lfwt->gfp, + true); /* * Linux seems to run the callback if it cannot find the firmware. @@ -200,8 +196,7 @@ linuxkpi_request_firmware(const struct linuxkpi_firmware **fw, const char *fw_name, struct device *dev) { - return (_linuxkpi_request_firmware(fw_name, fw, dev, GFP_KERNEL, false, - true)); + return (_linuxkpi_request_firmware(fw_name, fw, dev, GFP_KERNEL, true)); } int @@ -209,7 +204,7 @@ linuxkpi_firmware_request_nowarn(const struct linuxkpi_firmware **fw, const char *fw_name, struct device *dev) { - return (_linuxkpi_request_firmware(fw_name, fw, dev, GFP_KERNEL, false, + return (_linuxkpi_request_firmware(fw_name, fw, dev, GFP_KERNEL, false)); }