summary refs log tree commit diff
path: root/net
diff options
context:
space:
mode:
authorXiang Yang <xiangyang3@huawei.com>2023-08-03 07:24:38 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-16 18:27:26 +0200
commitb249c510b43ea77821fe85cbad2d7faab7510998 (patch)
tree6fd6345d98f8f3645c62bab5c1cbf2998717a1dc /net
parentfc0b41ac11069c77723bffd4c9c5adb4dcee635f (diff)
downloadlinux-b249c510b43ea77821fe85cbad2d7faab7510998.tar.gz
mptcp: fix the incorrect judgment for msk->cb_flags
commit 17ebf8a4c38b5481c29623f5e003fdf7583947f9 upstream.

Coccicheck reports the error below:
net/mptcp/protocol.c:3330:15-28: ERROR: test of a variable/field address

Since the address of msk->cb_flags is used in __test_and_clear_bit, the
address should not be NULL. The judgment for if (unlikely(msk->cb_flags))
will always be true, we should check the real value of msk->cb_flags here.

Fixes: 65a569b03ca8 ("mptcp: optimize release_cb for the common case")
Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Link: https://lore.kernel.org/r/20230803072438.1847500-1-xiangyang3@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/mptcp/protocol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 6034ea9ad115..61fefa1a82db 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3370,7 +3370,7 @@ static void mptcp_release_cb(struct sock *sk)
 
 	if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags))
 		__mptcp_clean_una_wakeup(sk);
-	if (unlikely(&msk->cb_flags)) {
+	if (unlikely(msk->cb_flags)) {
 		/* be sure to set the current sk state before tacking actions
 		 * depending on sk_state, that is processing MPTCP_ERROR_REPORT
 		 */