From nobody Sun Jul 5 18:34:14 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 4gtbjy2CJLz6kl2M for ; Sun, 05 Jul 2026 18:34:14 +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 4gtbjy1RwWz3f9D for ; Sun, 05 Jul 2026 18:34:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783276454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=50RGWEuillQ7dUavktGov0D0HeeD3LPYvxKBFdAtm+c=; b=xTtOczvHdOFJLa3EM6dWwm71Ug4W05WQpOU8Ff+6YYcrK0zSeeGa2seFJc/gPj4OSRp/Ym 21yMd12T/LZlpn4XFBrrD1R9N7bz8wLFqSZmax6tBxC2CgnRK29PsjvLUyTtpobxWugEME nqb58jr3C16/29RE994C1UfgPSY2NrzLtBWFz55z7cgTiFDvoCEwThWzKqv7lzdX+aCF8M Rr15YqSezLceA/SZm1qMiTVPM6u4Z+ZbpSoYBqTr3N0FXNpmcwJEyE7z9uP2Av+Av3VT/0 UV9SB2nWSmLw52nAIxqeqSy6xOjjNT5T66oWoSDcwd2ecgIW0Qip072XReqAUw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783276454; a=rsa-sha256; cv=none; b=EKan77tz4aYFm95CCj99Im7qs9QHBbXRbvWkWYL8oUjkwTNY6pIjm+1zM1xz3D0QsZ+4dO XRq+zJzm54/6jKyt71B4S2aWrtxvXOw7cXZqx1PFjEUu3oE71RR5Hx9vjElM7R39HPbwlN nFqKEJH31Pysk+n3sthYDduVZfaH11eyJOZvIvLwvUCQc/TUGm6jGJJ/0CSC/ebilbdASY fdnCtW4sTmiFPr9i8iq9XWkp2XtXkAajoIwps2alQNI2DVzcDJx2HjOwmGnZmDamqeJNX2 +kCZoRKkeLEU9PhE9tG5eajH/kMUV5jusMtrQT3O/0eiMic9yHFh89xFVXzLRw== 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=1783276454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=50RGWEuillQ7dUavktGov0D0HeeD3LPYvxKBFdAtm+c=; b=tf+2DzP0wDPCI9ztilxN6WTMXJrcz7DL/K9fjh3qdHbgEsOy4PUeK5oObQ/hiI6uV0uZWy tcDikpUDhKxyN7IA/mg0JuHb7TcgTS4mbZjVUbjz1NTVfLjRE9NBDU6WlxERS0mqNsoHgI YMmsPNDtUjSjGYdGXw7GVXvuohPhAlik44ElZpu5PnRYWBc0HEYfSeXu+zeVCaHtOkffIk CX6bmv23Ex5PEWKaJIKa/RvbyaJyc+gj53hrzffffhXjOAVhb9x4FAUInL0c5wsrhbfT9h 5JvtkyrLxgPgfHxt1Q/4kEXxtwrDQZvy6OTZjsEwXEo5o0E9hB0UhLfz3Me6mQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gtbjy04p3zVBR for ; Sun, 05 Jul 2026 18:34:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 390af by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 05 Jul 2026 18:34:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: 22ddc9eb1d7a - main - fwip: Fix M_PKTHDR loss in fwip_async_output broadcast path 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 22ddc9eb1d7a4fffe78b0692bdc4ec03e1d04ac4 Auto-Submitted: auto-generated Date: Sun, 05 Jul 2026 18:34:14 +0000 Message-Id: <6a4aa3a6.390af.45346727@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=22ddc9eb1d7a4fffe78b0692bdc4ec03e1d04ac4 commit 22ddc9eb1d7a4fffe78b0692bdc4ec03e1d04ac4 Author: Abdelkader Boudih AuthorDate: 2026-07-05 18:26:05 +0000 Commit: Adrian Chadd CommitDate: 2026-07-05 18:34:02 +0000 fwip: Fix M_PKTHDR loss in fwip_async_output broadcast path M_PREPEND in the broadcast branch may call m_prepend(9) which allocates a new head mbuf and calls m_move_pkthdr(), stripping M_PKTHDR from the old mbuf. xfer->mbuf was set before M_PREPEND, so it pointed at the deheadered old mbuf. bus_dmamap_load_mbuf(9) asserts M_PKTHDR and panics. Reviewed by: zlei, adrian Differential Revision: https://reviews.freebsd.org/D57495 --- sys/dev/firewire/if_fwip.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c index 0f37ce6a8e41..bdbe76e2caf4 100644 --- a/sys/dev/firewire/if_fwip.c +++ b/sys/dev/firewire/if_fwip.c @@ -539,13 +539,6 @@ fwip_async_output(struct fwip_softc *fwip, if_t ifp) * it adds the link-level encapsulation. */ - /* - * Put the mbuf in the xfer early in case we hit an - * error case below - fwip_output_callback will free - * the mbuf. - */ - xfer->mbuf = m; - /* * We use the arp result (if any) to add a suitable firewire * packet header before handing off to the bus. @@ -561,7 +554,18 @@ fwip_async_output(struct fwip_softc *fwip, if_t ifp) */ uint32_t *p; + /* + * M_PREPEND may move M_PKTHDR to a new head mbuf. + * Keep xfer->mbuf NULL until it succeeds. + */ + xfer->mbuf = NULL; M_PREPEND(m, 2*sizeof(uint32_t), M_NOWAIT); + if (m == NULL) { + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + fwip_output_callback(xfer); + continue; + } + xfer->mbuf = m; p = mtod(m, uint32_t *); fp->mode.stream.len = m->m_pkthdr.len; fp->mode.stream.chtag = broadcast_channel; @@ -584,6 +588,10 @@ fwip_async_output(struct fwip_softc *fwip, if_t ifp) struct fw_device *fd; struct fw_eui64 eui; + /* + * Error paths below let the callback free m. + */ + xfer->mbuf = m; eui.hi = ntohl(destfw->sender_unique_ID_hi); eui.lo = ntohl(destfw->sender_unique_ID_lo); if (fwip->last_dest.hi != eui.hi ||