From nobody Mon Jul 04 16:40:06 2022 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 3AAFF1893FF6; Mon, 4 Jul 2022 16:40:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LcBP32rnVz4S94; Mon, 4 Jul 2022 16:40:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656952807; 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=uYrstBo8h8sX9rKeG2Ucw5mmWvhvaIhZG3RAgtWkm/I=; b=KCdeN/mBz0ahH8RvbE4zbO4lsaJfb5Jl4nGwP3RyLaeKeDn9q5xudWI8FXCtKorsSNLMLc 5E48s7AHrso1B2igktsFfgSaf/Lrtgu1F6zN82TwQWSpIjEXEx+LmatJ6ckKXnHxFAeZm2 zgTjF8QpYTyK4M/48pzgJc5xPp0gl1S8sJGs4MYbTTc7vjDgjF4MKp27jZGJLCq+TyFGF+ bV4Y6YtA39oscKorRfIOuPcCqb3PrcqxyUEqs47ea6MbFes111+pG1Xu7yKi7VoUF0X0n4 XbC3ETPPU0+8z0x3ihUpAGSiY3KEpKNJft49v7CWNod7r3mWychlh8apRJB8GQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2461E148B4; Mon, 4 Jul 2022 16:40:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 264Ge6lK043740; Mon, 4 Jul 2022 16:40:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 264Ge62M043737; Mon, 4 Jul 2022 16:40:06 GMT (envelope-from git) Date: Mon, 4 Jul 2022 16:40:06 GMT Message-Id: <202207041640.264Ge62M043737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: bdedfb3a0068 - stable/13 - if_ffec: free the dmamem allocation in detach List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bdedfb3a0068f08867f47b4ffad98297e5345c94 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656952807; 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=uYrstBo8h8sX9rKeG2Ucw5mmWvhvaIhZG3RAgtWkm/I=; b=gGfSo20BXIBpcmuHvZUlOY4Id5+blxfA5ByYAIkz8Ah8pADl1qpZlJtOe/kVOhYyC+WHdQ btPgUuHKVGDbjhkfufpZnYl82XsEvqz8cxI+mqvxmUVgCtftxk3ukUvdxAr4RHABOdV+HM Dab67uEtp08/sXpVKvQUB4qvRi942s5Gei6S9pG23DOs/NsiumCxTFFgxn/3w/k1MKrH3E 4WMQLlO1lHCno2gbrbpm9UqM33fqt2re86aWs152KGBFrJonmonoEFMQzXEImnD3BtAiUj 7d+Q5fs+05jspyd5kaK60zEVMxdE6BtiaiIZq0qYd9lx3NDuh8eSXNU5Nf722w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656952807; a=rsa-sha256; cv=none; b=szDwG9sCAmeaW0dAleriz9WboTxM9NnHl8SQJ6JwIyzFZpyaLs1zpnL+/LoQYMlKiTFFQD BXrxmgGVwLLpMe4xwdFb7GfxXHA8igW3Nv/bEMVMzqILhe94tTo3I8IZDd6/n3V5upg/zT hHpiq9smgaKzV867KdL0OyiLxVW8Y69jBB/qYlccx/3Fb7iI/pbbZBNEpAYqPHiF0AzYTU fPVWx3beNjWLVtWojTKue+1H8g0AGJnEUjTt69OLsdsDqodqVuEnGwHh2GLR5PsvVO68Vy jAQVNgzuklsMW4vlA8a7owPwLXR48KSX6ezc7+03Y36mNfskrlx2kbcXDCq3MA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bdedfb3a0068f08867f47b4ffad98297e5345c94 commit bdedfb3a0068f08867f47b4ffad98297e5345c94 Author: Mitchell Horne AuthorDate: 2022-06-15 15:53:25 +0000 Commit: Mitchell Horne CommitDate: 2022-07-04 16:34:57 +0000 if_ffec: free the dmamem allocation in detach Calling bus_dmamap_destroy() for a mapping which was allocated with bus_dmamem_alloc() will result in a panic. This change is not run-time tested, but I identified the issue while implementing the analogous method in if_dwc(4), using this implementation as the template. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 8757d0fca9e6a9e174bc87728e296e5338d30eb7) --- sys/dev/ffec/if_ffec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/ffec/if_ffec.c b/sys/dev/ffec/if_ffec.c index 66e053fcdf67..090869abeba1 100644 --- a/sys/dev/ffec/if_ffec.c +++ b/sys/dev/ffec/if_ffec.c @@ -1425,7 +1425,8 @@ ffec_detach(device_t dev) bus_dma_tag_destroy(sc->rxbuf_tag); if (sc->rxdesc_map != NULL) { bus_dmamap_unload(sc->rxdesc_tag, sc->rxdesc_map); - bus_dmamap_destroy(sc->rxdesc_tag, sc->rxdesc_map); + bus_dmamem_free(sc->rxdesc_tag, sc->rxdesc_ring, + sc->rxdesc_map); } if (sc->rxdesc_tag != NULL) bus_dma_tag_destroy(sc->rxdesc_tag); @@ -1441,7 +1442,8 @@ ffec_detach(device_t dev) bus_dma_tag_destroy(sc->txbuf_tag); if (sc->txdesc_map != NULL) { bus_dmamap_unload(sc->txdesc_tag, sc->txdesc_map); - bus_dmamap_destroy(sc->txdesc_tag, sc->txdesc_map); + bus_dmamem_free(sc->txdesc_tag, sc->txdesc_ring, + sc->txdesc_map); } if (sc->txdesc_tag != NULL) bus_dma_tag_destroy(sc->txdesc_tag);