From nobody Thu Jun 23 18:16:04 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 DD10687683B; Thu, 23 Jun 2022 18:16:05 +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 4LTT2r5JYKz3P34; Thu, 23 Jun 2022 18:16:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656008164; 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=RT8wuVX7sFmmMDiVcRRwpcJzusC1O7vnpAiS2Zjggtw=; b=sDyV32vWkM0cLLdTPRbMk1GCiNi2gr1L1EfelnSJ1q75uYZrFabSFo+6/lUx7G8CbWcfmq Mz8oKJMQ84TcHVT2s8lvXc3L/uEyHoZbySE0/fPgXRND1/Igw575gTLvL3b6YOvAtc7VE0 Cx1jfCvqm+y3R+U4T3W16NFuqXMFTO0kIVEcdY61rBYZCU5fBiZNpkPRkrK7jimiqjUYHD ljjQ925map2X27tfJVqaKvkjbG4D4P0Vb5cu4XktE4xXw2WOPA+f+exJSE3U3Ndzw1/SQX pgPtWDGdLasI/YV/XqbVIGQA1iB+M6SyadkIySIxQdrODjXXPqNxW9g35WVobA== 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 8645B20038; Thu, 23 Jun 2022 18:16:04 +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 25NIG4ei014855; Thu, 23 Jun 2022 18:16:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25NIG4Wi014854; Thu, 23 Jun 2022 18:16:04 GMT (envelope-from git) Date: Thu, 23 Jun 2022 18:16:04 GMT Message-Id: <202206231816.25NIG4Wi014854@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 8757d0fca9e6 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 8757d0fca9e6a9e174bc87728e296e5338d30eb7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656008164; 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=RT8wuVX7sFmmMDiVcRRwpcJzusC1O7vnpAiS2Zjggtw=; b=AfjsY3golNcLNbOWc2ytDVmT1aCTmvqm6bJekOYo+XoWuPfqJndVZMcDKzTpe1fjLzZzJG fX4jAuGT24U31Ji+At5Mnc8aZQL0oNMaxTIWFmLMKjURhS21zW+LDPrd3kZFVDHXrNP+uV ZRrSX35px8Abu3qUMIoTYehlCAyjflN9BQw5MWtatjEpTLblNXrbBl2H0nK69od5V+0sfL oAx6dNUYUp5nnKR1GpzBjZ4qL1QZrj6QFuV2/dQTyFygEl35/GxB9PdgmMN610XxxJglFs qFdF54F0DsmOr3BW9aSe0eDzIRJKTThdqqVaYqGkus/UxN0HwCoU9asFcrlzJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656008164; a=rsa-sha256; cv=none; b=QR/aEU4S+AzNmOwOSDwPK81SHCB1IqoHzAq20XYl/rDUbZvnYtdgRYWmaGc4G6SgDbLhlS cp+6byNw6NCaPwlTQWRAJDZo5MdWCatVziMLGXDuctXqCI8H06c4S6/67y7CiupPeY0ffk SOknrs/jP9EsAxkhthFqEnR2zLpkBTbNj8UkIqywGILZH21SBNGCjPijaVNfOOjCFNDN5p S7oAnAfVfc/GO1GENtJfLhPsckHyUQvZu6wxzFc2WE1Hraskpmqkm/8J3XPR2oEzhoetog kF8dr+v/6455vhGKYuQqyguJpkAmUOPsubV79ha4Rz20Ywd0Oje+F7MOgjj/2Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=8757d0fca9e6a9e174bc87728e296e5338d30eb7 commit 8757d0fca9e6a9e174bc87728e296e5338d30eb7 Author: Mitchell Horne AuthorDate: 2022-06-15 15:53:25 +0000 Commit: Mitchell Horne CommitDate: 2022-06-23 18:15:10 +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 --- 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 cd3681dbb24c..f98e408265fd 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);