Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Dec 2021 11:15:36 GMT
From:      Randall Stewart <rrs@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: dcf2dfed26ed - main - tcp: unloading a module that is set to default should error.
Message-ID:  <202112021115.1B2BFa1v068630@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rrs:

URL: https://cgit.FreeBSD.org/src/commit/?id=dcf2dfed26ed34602e17bee9318f0fde9429577e

commit dcf2dfed26ed34602e17bee9318f0fde9429577e
Author:     Randall Stewart <rrs@FreeBSD.org>
AuthorDate: 2021-12-02 11:12:16 +0000
Commit:     Randall Stewart <rrs@FreeBSD.org>
CommitDate: 2021-12-02 11:12:16 +0000

    tcp: unloading a module that is set to default should error.
    
    I just discovered that the return of the EBUSY error was incorrectly
    rigged so that you could unload a CC module that was set to default.
    Its supposed to be an EBUSY error. Make it so.
    
    Reviewed by: Michael Tuexen
    Sponsored by: Netflix Inc.
    Differential Revision: https://reviews.freebsd.org/D33229
---
 sys/netinet/cc/cc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c
index b49e5940bc7e..bcda9276d4d9 100644
--- a/sys/netinet/cc/cc.c
+++ b/sys/netinet/cc/cc.c
@@ -246,14 +246,13 @@ cc_deregister_algo(struct cc_algo *remove_cc)
 	STAILQ_FOREACH_SAFE(funcs, &cc_list, entries, tmpfuncs) {
 		if (funcs == remove_cc) {
 			if (cc_check_default(remove_cc)) {
-				err = EBUSY;
-				break;
+				CC_LIST_WUNLOCK();
+				return(EBUSY);
 			}
-			/* Add a temp flag to stop new adds to it */
-			funcs->flags |= CC_MODULE_BEING_REMOVED;
 			break;
 		}
 	}
+	remove_cc->flags |= CC_MODULE_BEING_REMOVED;
 	CC_LIST_WUNLOCK();
 	err = tcp_ccalgounload(remove_cc);
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112021115.1B2BFa1v068630>