From nobody Sat May 14 13:28:45 2022 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 7A0A21AE1C2F; Sat, 14 May 2022 13:28:45 +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 4L0mYn2zXlz4fvF; Sat, 14 May 2022 13:28:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652534925; 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=A0mYUQZ+P/NdNScEAC8rNqcmzYdLzd2T3CLUHHttJ0I=; b=Ouuu4YJHpGvff1lyzGGQwfeUaphsN2C8XR+4cyqgG77AbA5qPfgF8AvguRTcI9mbtwEILM ZMDoSf6zIMmAKtVCV+R7Af+01vJtaCyaS8pP8Ial9kJTxX081sxO2F2dJe9JHVLA/kWHit LwwadhRlIfl/8bYUjF37QO5jDqzzKNM3E2mxmXi5DdEJlSkjt5tvuwa2DX1omyZxh34kQ/ 5y9nYltaptQNKVpe9xfUgPSqe0cyt3S+squprXpnorgs+Fjj722quycP5c3dJxpS8nTKFE sc0k3jxn6wby1rYzA/TY6Lv24uyCjgqFbBwZDks8fZLD0lcHxTawsCZvwLndCg== 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 3FA32182E8; Sat, 14 May 2022 13:28:45 +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 24EDSjMl051316; Sat, 14 May 2022 13:28:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24EDSjes051315; Sat, 14 May 2022 13:28:45 GMT (envelope-from git) Date: Sat, 14 May 2022 13:28:45 GMT Message-Id: <202205141328.24EDSjes051315@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: a84bf5eaa10c - main - debugnet: fix an errant assertion 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: a84bf5eaa10c2db8856c7497b63ae3caceac8c17 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652534925; 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=A0mYUQZ+P/NdNScEAC8rNqcmzYdLzd2T3CLUHHttJ0I=; b=E6/kVm6IbT7IwFFQV+5B7xA6VxYuxLOi8A28B1oNBe6A/nwPzOW+iB1PCoUWvNnd526v9g 4QS2+ZjXmGk7t9CoAHiMi5H8wPhvj8DiDBxSahOfokEf+V8s0R6lapYiV4U6rdDy41Icwb kmxPDYM2pKI+Ncd9L2TGTPrbrPr9lGpikFUxzaX4sZmmknDcAdQZQ0dnebR7D7P3rCONJO cXrSavodIpZQH/CWJzUIGIP8Ns1CL7INTR4VC7HV2qqPzba91CVegs9nKxK536AybxwqcX XudG43PAmcvVf2G4/nC0bM1YT1GBYRmcpJUTFaZNAd7WBsJuSXcR0n7cuj5kFQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652534925; a=rsa-sha256; cv=none; b=HG6iuYgwh4kz2HouFE1r0M6lDzY+pkccic5HgBcBpEBHWXpXX5AnnxLnGiFF+/ZZ8I50eZ 0y05PCF0cZcq9aiHlwISwEKXI03ocOm3wc1XvaZrFBMKAK4ZzbXFtoz5UDFnQpQvE7xZTp IfFEk8B2FftfBgwZBX+OSVstpU5dmxRSIwWI7/+cqlnkZg657F1Eh6ZyuESfNVZQuLlydO a/9IfKCWVmY8vYuC5wcbMPXTt8fcqBhWEyXCDYGX2JCj2VjbNUzsKAwR8A72Ykvz041XJz WLoj+rb1B0s6ccgZ1h3YchUZn2g8/pE0oNvYJ8r1kPFLfi/QDQGbdck2ssvimw== 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=a84bf5eaa10c2db8856c7497b63ae3caceac8c17 commit a84bf5eaa10c2db8856c7497b63ae3caceac8c17 Author: Mitchell Horne AuthorDate: 2022-05-14 13:23:08 +0000 Commit: Mitchell Horne CommitDate: 2022-05-14 13:27:53 +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 --- 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. */