Commit db3fada
packet: Move reference count in packet_sock to atomic_long_t
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)" <security@ncsc.gov.uk>
Co-developed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: stable@kernel.org
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20231201131021.19999-1-daniel@iogearbox.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 79321a7 commit db3fada
2 files changed
+9
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4300 | 4300 | | |
4301 | 4301 | | |
4302 | 4302 | | |
4303 | | - | |
| 4303 | + | |
4304 | 4304 | | |
4305 | 4305 | | |
4306 | 4306 | | |
| |||
4310 | 4310 | | |
4311 | 4311 | | |
4312 | 4312 | | |
4313 | | - | |
| 4313 | + | |
4314 | 4314 | | |
4315 | 4315 | | |
4316 | 4316 | | |
| |||
4405 | 4405 | | |
4406 | 4406 | | |
4407 | 4407 | | |
4408 | | - | |
| 4408 | + | |
4409 | 4409 | | |
4410 | 4410 | | |
4411 | 4411 | | |
| |||
4508 | 4508 | | |
4509 | 4509 | | |
4510 | 4510 | | |
4511 | | - | |
| 4511 | + | |
4512 | 4512 | | |
4513 | 4513 | | |
4514 | 4514 | | |
| |||
4526 | 4526 | | |
4527 | 4527 | | |
4528 | 4528 | | |
4529 | | - | |
4530 | | - | |
4531 | | - | |
| 4529 | + | |
| 4530 | + | |
| 4531 | + | |
4532 | 4532 | | |
4533 | 4533 | | |
4534 | 4534 | | |
| |||
4606 | 4606 | | |
4607 | 4607 | | |
4608 | 4608 | | |
4609 | | - | |
| 4609 | + | |
4610 | 4610 | | |
4611 | 4611 | | |
4612 | 4612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
0 commit comments