Re: [PATCH net] net/packet: move reference count in packet_sock to 64 bits
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2023-12-01 09:35:51
On Fri, Dec 01, 2023 at 10:19:35AM +0100, Daniel Borkmann wrote:
On 11/30/23 4:15 PM, Willem de Bruijn wrote:quoted
Daniel Borkmann wrote:quoted
On 11/30/23 3:20 PM, Greg Kroah-Hartman wrote:quoted
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 64bit atomic reference count to prevent the possibility of this type of overflow. Because we can not handle saturation, using refcount_t is not possible in this place. Maybe someday in the future if it changes could it be used. Original version from Daniel after I did it wrong, I've provided a changelog. Reported-by: "The UK's National Cyber Security Centre (NCSC)" <redacted> Cc: stable <stable@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>Thanks! Acked-by: Daniel Borkmann <daniel@iogearbox.net>Acked-by: Willem de Bruijn <willemb@google.com>There was feedback from Linus that switching to atomic_long_t is better choice so that it doesn't penalize 32-bit architectures. Will post a v2 today.
Thanks, makes sense to do it that way. greg k-h