Date: Mon, 31 May 2021 08:56:56 GMT From: Richard Scheffenegger <rscheff@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 11417329c930 - stable/12 - tcp: Use local CC data only in the correct context Message-ID: <202105310856.14V8uu56003507@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=11417329c930adbed6297cd76f18c2b4ae7f5120 commit 11417329c930adbed6297cd76f18c2b4ae7f5120 Author: Richard Scheffenegger <rscheff@FreeBSD.org> AuthorDate: 2021-05-26 17:45:06 +0000 Commit: Richard Scheffenegger <rscheff@FreeBSD.org> CommitDate: 2021-05-31 06:58:34 +0000 tcp: Use local CC data only in the correct context Most CC algos do use local data, and when calling newreno_cong_signal from there, the latter misinterprets the data as its own struct, leading to incorrect behavior. Reported by: chengc_netapp.com Reviewed By: chengc_netapp.com, tuexen, #transport MFC after: 3 days Sponsored By: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D30470 (cherry picked from commit c358f1857f0c749ad166fb9e9bef04f4033f3a72) --- sys/netinet/cc/cc_newreno.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c index 2379ae64e684..acc4fcfcda22 100644 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -242,7 +242,12 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) cwin = CCV(ccv, snd_cwnd); mss = tcp_maxseg(ccv->ccvc.tcp); - nreno = ccv->cc_data; + /* + * Other TCP congestion controls use newreno_cong_signal(), but + * with their own private cc_data. Make sure the cc_data is used + * correctly. + */ + nreno = (CC_ALGO(ccv->ccvc.tcp) == &newreno_cc_algo) ? ccv->cc_data : NULL; beta = (nreno == NULL) ? V_newreno_beta : nreno->beta; beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; if (V_cc_do_abe && type == CC_ECN) @@ -332,6 +337,9 @@ newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) if (sopt->sopt_valsize != sizeof(struct cc_newreno_opts)) return (EMSGSIZE); + if (CC_ALGO(ccv->ccvc.tcp) != &newreno_cc_algo) + return (ENOPROTOOPT); + nreno = ccv->cc_data; opt = buf;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105310856.14V8uu56003507>