From nobody Fri May 27 16:23:31 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 000CB1B4F955; Fri, 27 May 2022 16:23:32 +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 4L8qqS2vhqz3sFl; Fri, 27 May 2022 16:23:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653668612; 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=zcbVA+ZqBwGjM5NZ5HF9pgqzjC1RdgdI+VwjZ7ygxkw=; b=XT/L7RcCxpet4nwHW2G9+HwzUzym2QGlGo4VuxrlbTWhugEZP1PA28jfSNWXfOj3BguRiC PukkZsq+01NDZ1VvfjIzwbYrQzEGxCiN7jp64wbOfG0PoHtMESJ1W3/mZX/W4fo7jLLVIQ Kb7IFWmm7c+WivmouTiGsQ56jXg4cbYvQ6kmhHR3Ri2SiCYGoBIgoNqDAs83nl5ZlyVCXw UUa9RKXurBiAL/73l5l4IZowhXWRvLqmw5RhKB/XuXho6aDBSgms7hvy09PTwpAhL0akjQ UzpfnUicvOlAHs4VE6syn4cqbkYVjJmQkjD9k3lur/H5LEPO45hlFH2TJbkfcQ== 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 F05CD254E7; Fri, 27 May 2022 16:23:31 +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 24RGNVan096661; Fri, 27 May 2022 16:23:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24RGNV4j096660; Fri, 27 May 2022 16:23:31 GMT (envelope-from git) Date: Fri, 27 May 2022 16:23:31 GMT Message-Id: <202205271623.24RGNV4j096660@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: eda5293cd74a - stable/13 - debugnet: fix an errant assertion 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: eda5293cd74a1a75cfa415ffcc0f49242b4622c3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653668612; 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=zcbVA+ZqBwGjM5NZ5HF9pgqzjC1RdgdI+VwjZ7ygxkw=; b=TKzBSpvIc6NyIOGsg0JXfGDRWbxoCRSddf44TWoo/HvafhlUpUnfem5+rz2I/0OJ4BWyJv kXKSX4ZRq2kBYdrKxIAeeCPVItO+UUnsVQaBLIV1buHpXS4uJQ9xG6tvowi26ad4fwf2nC 3fluF3tJjUvyUod/0attFvNlqzV/EjL8SJdiX6NjJ3l48i/7TThj6XlZ7a17gpAJLWcF+1 jVz5yQl7g8MeKiIr9cHg6O4dSvWZHtNP4p/2dToiKLpDZNnYtZm5QZAItagLPaq6izbeWk wJODYUUzjzORjuioPhTAyMSh76eNwXUxxh475p0Zlyu0OX/fYF5iczWeYZoYEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653668612; a=rsa-sha256; cv=none; b=mOaNzLFCe+h3AeS7wxlPJNuVL3nFus9FJQG5we/n05cTJVMEahq7iNjZ1jvtZ9tzxseKSp hxiiq5rzMRu4RbUZysaxK5Y3nKkFxhez5hXKWA/AeqRpnO51X/sajLCx6HMJ1EtaCSMpxr vssImlIN15LJa9A2PeOEfYjDpm7Sp3rag6BtOxQLUzpPGTAfwJxrcBugX7Zi/TJKuuHZgX tY/9y9kwReFCnkEYOd2Oey9SYeY45d8k6bCmF5hGZuB0u6rjBEBL9lLu+HissDuIQ1KL39 9Bl7pyya9LUjUxNlnGWKfeM1sz23kDMPqviztzELK7yyROAqomgQ8vxMKdj7+g== 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=eda5293cd74a1a75cfa415ffcc0f49242b4622c3 commit eda5293cd74a1a75cfa415ffcc0f49242b4622c3 Author: Mitchell Horne AuthorDate: 2022-05-14 13:23:08 +0000 Commit: Mitchell Horne CommitDate: 2022-05-27 16:22:48 +0000 debugnet: fix an errant assertion We may call debugnet_free() before g_debugnet_pcb_inuse is true, specifically in the cases where the interface is down or does not support debugnet. pcb->dp_drv_input is used to hold the real driver if_input callback while debugnet is in use, so we can check the status of this field in the assertion. This can be triggered trivially by trying to configure netdump on an unsupported interface at the ddb prompt. Initializing the dp_drv_input field to NULL explicitly is not necessary but helps display the intent. PR: 263929 Reported by: Martin Filla Reviewed by: cem, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35179 (cherry picked from commit a84bf5eaa10c2db8856c7497b63ae3caceac8c17) --- sys/net/debugnet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c index 7a2c98ace65d..fa8d64ab86c8 100644 --- a/sys/net/debugnet.c +++ b/sys/net/debugnet.c @@ -605,8 +605,8 @@ debugnet_free(struct debugnet_pcb *pcb) { struct ifnet *ifp; - MPASS(g_debugnet_pcb_inuse); MPASS(pcb == &g_dnet_pcb); + MPASS(pcb->dp_drv_input == NULL || g_debugnet_pcb_inuse); ifp = pcb->dp_ifp; if (ifp != NULL) { @@ -646,6 +646,7 @@ debugnet_connect(const struct debugnet_conn_params *dcp, .dp_seqno = 1, .dp_ifp = dcp->dc_ifp, .dp_rx_handler = dcp->dc_rx_handler, + .dp_drv_input = NULL, }; /* Switch to the debugnet mbuf zones. */