android_kernel_motorola_sm6375/net/packet
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Daniel Borkmann 148d8f0707 packet: Move reference count in packet_sock to atomic_long_t
commit db3fadacaf0c817b222090290d06ca2a338422d0 upstream.

In some potential instances the reference count on struct packet_sock
could be saturated and cause overflows which gets the kernel a bit
confused. To prevent this, move to a 64-bit atomic reference count on
64-bit architectures to prevent the possibility of this type to overflow.

Because we can not handle saturation, using refcount_t is not possible
in this place. Maybe someday in the future if it changes it could be
used. Also, instead of using plain atomic64_t, use atomic_long_t instead.
32-bit machines tend to be memory-limited (i.e. anything that increases
a reference uses so much memory that you can't actually get to 2**32
references). 32-bit architectures also tend to have serious problems
with 64-bit atomics. Hence, atomic_long_t is the more natural solution.

Reported-by: "The UK's National Cyber Security Centre (NCSC)" <[email protected]>
Co-developed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: [email protected]
Reviewed-by: Willem de Bruijn <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-12-13 18:18:14 +01:00
..
af_packet.c packet: Move reference count in packet_sock to atomic_long_t 2023-12-13 18:18:14 +01:00
diag.c af_packet: Fix data-races of pkt_sk(sk)->num. 2023-06-09 10:28:53 +02:00
internal.h packet: Move reference count in packet_sock to atomic_long_t 2023-12-13 18:18:14 +01:00
Kconfig
Makefile