From nobody Sat Apr 02 12:49:47 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 24B091A441B8; Sat, 2 Apr 2022 12:49:48 +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 4KVxhD0R4Vz4Rxy; Sat, 2 Apr 2022 12:49:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648903788; 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=9p/TPoQc0kvxLjZNjFLDvmYFYJviREoQ/qmkQG66JPY=; b=Gf3wQff9qq+YF3JBfbWL3sMSHYktjSQZ5o24Nd4L0ohldV6ZciRfGr/74qWzGP5iQoZqzj Qdjf4rTdXh5kRkg5an/9EwkAyu7Wpi/pL3YmlZXhF7opTKqojAE/M/BlwQurA0heVC+Xex G9dSFjcx+MOre/sipPAIftm/CUWi2OdUYEnWA5o//srnp2Tk2JEkBi2tByKtojHHXEPude Pu1XGsJl3JZERitqG7q1Hv9ups0f13FBYv14V8/9Bbk+4b6jett8F0uKYhDBXPFd3uG6Vi gHMLjQ4ro1q1lraqx5yE0RRxN0M2G1UkpQsPDKj++kQplXaKZtev8JqkixK4bw== 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 DEAECDB5; Sat, 2 Apr 2022 12:49:47 +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 232CnlX8031718; Sat, 2 Apr 2022 12:49:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 232CnlMR031717; Sat, 2 Apr 2022 12:49:47 GMT (envelope-from git) Date: Sat, 2 Apr 2022 12:49:47 GMT Message-Id: <202204021249.232CnlMR031717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: d4290f7e6237 - main - Revert "sctp: remove a test, which isn't safe" 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: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4290f7e62374ae3ad9853128a31c39347a4dae1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648903788; 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=9p/TPoQc0kvxLjZNjFLDvmYFYJviREoQ/qmkQG66JPY=; b=sHZOdcIgueiIwyzmDLYJwpNIKYfAmiiK6Z30JVJjpTb6OIIIr5sWNLw38ih+xWeaxc/c7Z eNEkYoy+KPqM+Zp4qadKBkc3NpIv1uSOhrmV9Af0UfuWYSVFdVZI7A62d3++b12DM1lokl XMypEgciQ7PaR9DsyMnXSnjdUE1liK5MR5PmgwYerEgQzJ+0MBrV+Q6Eb1wXur2LVZvlR8 8epGWhJVga1tEAPw5nuj0C8eJUM7fk4ECYnqoB127zVVOUOxyty/c2jGvqI4RM6PtLX6JD XR/3AZHD7aB22kBCguLppnDKIsI1Fx2b07APSwuIOFbtyKLUPhFJh4rez2a/DA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648903788; a=rsa-sha256; cv=none; b=UFYrdCSD9wLSMNzXOQSq6sk+9ypj83vApiM4k9H+PNDqeup/tooMhu6Ur05spOUkGQkOlf PuknBex8LBvsc30LdysMNFAtSB0PxkDW6iH7UhKWXM6YR4UlevOYu3ZnPUBuVjyNb8BSqu xRmo/FrXxNlt3D73Vb0MzxKFnKFZu+N5QMDRDUQzs7ONhW5F5dGfKpOFka9La38fTsY2RS pxmunta1tjwKsYkG9b4gKGbYJnAF1pT5vKOOpaYm+0vxsKM5DdgluV9VKqUqVR4yHnvW23 64AyR4B7W66HzuhJM52rc3lalfGL5+NBPOyoBnUn3A9PuTu/gZgfGM3ispOPcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=d4290f7e62374ae3ad9853128a31c39347a4dae1 commit d4290f7e62374ae3ad9853128a31c39347a4dae1 Author: Michael Tuexen AuthorDate: 2022-04-02 12:49:14 +0000 Commit: Michael Tuexen CommitDate: 2022-04-02 12:49:14 +0000 Revert "sctp: remove a test, which isn't safe" It included unrelated changes still under review. This reverts commit b1fe92b28ba2e77395598db1c2ff1976b55c86ab. --- sys/netinet/cc/cc.c | 29 ++++++++++------------------- sys/netinet/sctp_output.c | 5 +++++ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c index a009998ca920..55a5f6ef652e 100644 --- a/sys/netinet/cc/cc.c +++ b/sys/netinet/cc/cc.c @@ -280,12 +280,15 @@ cc_init(void) /* * Returns non-zero on success, 0 on failure. */ -static int -cc_deregister_algo_locked(struct cc_algo *remove_cc) +int +cc_deregister_algo(struct cc_algo *remove_cc) { struct cc_algo *funcs; int found = 0; + /* Remove algo from cc_list so that new connections can't use it. */ + CC_LIST_WLOCK(); + /* This is unlikely to fail */ STAILQ_FOREACH(funcs, &cc_list, entries) { if (funcs == remove_cc) @@ -293,34 +296,23 @@ cc_deregister_algo_locked(struct cc_algo *remove_cc) } if (found == 0) { /* Nothing to remove? */ + CC_LIST_WUNLOCK(); return (ENOENT); } /* We assert it should have been MOD_QUIESCE'd */ KASSERT((remove_cc->flags & CC_MODULE_BEING_REMOVED), ("remove_cc:%p does not have CC_MODULE_BEING_REMOVED flag", remove_cc)); if (cc_check_default(remove_cc)) { + CC_LIST_WUNLOCK(); return(EBUSY); } if (remove_cc->cc_refcount != 0) { + CC_LIST_WUNLOCK(); return (EBUSY); } - /* Remove algo from cc_list so that new connections can't use it. */ STAILQ_REMOVE(&cc_list, remove_cc, cc_algo, entries); - return (0); -} - -/* - * Returns non-zero on success, 0 on failure. - */ -int -cc_deregister_algo(struct cc_algo *remove_cc) -{ - int ret; - - CC_LIST_WLOCK(); - ret = cc_deregister_algo_locked(remove_cc); CC_LIST_WUNLOCK(); - return (ret); + return (0); } /* @@ -636,8 +628,7 @@ cc_modevent(module_t mod, int event_type, void *data) * If -f was used and users are still attached to * the algorithm things are going to go boom. */ - err = cc_deregister_algo_locked(algo); - CC_LIST_WUNLOCK(); + err = cc_deregister_algo(algo); if ((err == 0) && (algo->mod_destroy != NULL)) { algo->mod_destroy(); } diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 4ef771b0cc1a..5f205b1c3af4 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -13657,6 +13657,11 @@ out_unlocked: if (free_cnt_applied) { atomic_subtract_int(&asoc->refcnt, 1); } +#ifdef INVARIANTS + if (mtx_owned(&stcb->tcb_mtx)) { + panic("Leaving with tcb mtx owned?"); + } +#endif } if (top != NULL) { sctp_m_freem(top);