net/tcp_sigpool: Use kref_get_unless_zero()
authorDmitry Safonov <dima@arista.com>
Fri, 22 Dec 2023 01:13:59 +0000 (01:13 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Jan 2024 14:42:05 +0000 (14:42 +0000)
commitb901a4e276943f61e11ddb597a0abc1e7dfadf0f
tree16373ff28e2e7a910f579d8559099acf9b82944f
parent8fcb0382af6f1ef50936f1be05b8149eb2f88496
net/tcp_sigpool: Use kref_get_unless_zero()

The freeing and re-allocation of algorithm are protected by cpool_mutex,
so it doesn't fix an actual use-after-free, but avoids a deserved
refcount_warn_saturate() warning.

A trivial fix for the racy behavior.

Fixes: 8c73b26315aa ("net/tcp: Prepare tcp_md5sig_pool for TCP-AO")
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_sigpool.c