The current implementation of rose_neigh uses 'use' and 'count' field of
type unsigned short as a reference count. This approach lacks atomicity,
leading to potential race conditions. As a result, syzbot has reported
slab-use-after-free errors due to unintended removals.
This series introduces refcount_t for reference counting to ensure
atomicity and prevent race conditions. The patches are structured as
follows:
1. Refactor rose_remove_neigh() to separate removal and freeing operations
2. Convert 'use' field to refcount_t for appropriate reference counting
3. Include references from rose_node to 'use' field
These changes should resolve the reported slab-use-after-free issues and
improve the overall stability of the ROSE network layer.
Takamitsu Iwai (3):
net: rose: split remove and free operations in rose_remove_neigh()
net: rose: convert 'use' field to refcount_t
net: rose: include node references in rose_neigh refcount
include/net/rose.h | 18 +++++++++++++-
net/rose/af_rose.c | 10 ++++----
net/rose/rose_in.c | 12 +++++-----
net/rose/rose_route.c | 55 ++++++++++++++++++++++++++-----------------
net/rose/rose_timer.c | 2 +-
5 files changed, 61 insertions(+), 36 deletions(-)
--
2.39.5 (Apple Git-154)