]> www.infradead.org Git - users/dwmw2/linux.git/commit
tcp: only release congestion control if it has been initialized
authorPengcheng Yang <yangpc@wangsu.com>
Fri, 25 Oct 2024 08:45:44 +0000 (16:45 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 1 Nov 2024 01:22:48 +0000 (18:22 -0700)
commitcf44bd08cdeeeceb61a439f9dc437ded23adb75d
tree0987e4913aaf3354201300530899c0d70b166366
parent5b1c965956744d9b22fae7e9bca1c8e72355e1d0
tcp: only release congestion control if it has been initialized

Currently, when cleaning up congestion control, we always call the
release regardless of whether it has been initialized. There is no
need to release when closing TCP_LISTEN and TCP_CLOSE (close
immediately after socket()).

In this case, tcp_cdg calls kfree(NULL) in release without causing
an exception, but for some customized ca, this could lead to
unexpected exceptions. We need to ensure that init and release are
called in pairs.

Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
Link: https://patch.msgid.link/1729845944-6003-1-git-send-email-yangpc@wangsu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp.c
net/ipv4/tcp_cong.c