Skip to content

net/local: fix SCM_RIGHTS pointer and memory corruption - #19902

Open
Bogdan0759 wants to merge 1 commit into
apache:masterfrom
Bogdan0759:fix-scm-rights
Open

net/local: fix SCM_RIGHTS pointer and memory corruption#19902
Bogdan0759 wants to merge 1 commit into
apache:masterfrom
Bogdan0759:fix-scm-rights

Conversation

@Bogdan0759

Copy link
Copy Markdown

Summary

Fix NULL pointer dereference and fix memory corruption by using file_put() instead of file_close() + kmm_free().
Add peer NULL check to local_freectl().

Impact

Fixes kernel panic and memory corruption after recvmsg(SCM_RIGHTS).

Testing

Board: qemu_intel64:nsh
Tested with program that exhausts fd table and call recvmsg(SCM_RIGHTS).

@github-actions github-actions Bot added Area: Networking Effects networking subsystem Size: XS The size of the change in this PR is very small labels Aug 20, 2026
@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@Bogdan0759 please fix ci error:

0c3e75cd0c Merge e8f9b3ba010cc1e6bc0e79cc6ec0bcc15c3edcab into 6ccb459e1a79c4a0de4e32353f98b72d2bc081e1
e8f9b3ba01 net/local: fix SCM_RIGHTS pointer and memory corruption
../nuttx/tools/checkpatch.sh -c -u -m -g  6ccb459e1a79c4a0de4e32353f98b72d2bc081e1..HEAD
❌ Missing Signed-off-by
Used config files:
    1: .codespellrc
Some checks failed. For contributing guidelines, see:
  https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md

@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@Bogdan0759

Copy link
Copy Markdown
Author

@Bogdan0759 please fix ci error:

0c3e75cd0c Merge e8f9b3ba010cc1e6bc0e79cc6ec0bcc15c3edcab into 6ccb459e1a79c4a0de4e32353f98b72d2bc081e1
e8f9b3ba01 net/local: fix SCM_RIGHTS pointer and memory corruption
../nuttx/tools/checkpatch.sh -c -u -m -g  6ccb459e1a79c4a0de4e32353f98b72d2bc081e1..HEAD
❌ Missing Signed-off-by
Used config files:
    1: .codespellrc
Some checks failed. For contributing guidelines, see:
  https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md

Added

@jerpelea jerpelea left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a commit message describing the change

Fix NULL pointer dereference and memory corruption by using
file_put() instead of file_close() + kmm_free().
Add peer NULL check to local_freectl().

Signed-off-by: Bogdan <Bogdan4ik0759@gmail.com>
@Bogdan0759

Copy link
Copy Markdown
Author

please add a commit message describing the change

Done

@Bogdan0759
Bogdan0759 requested a review from jerpelea August 20, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Networking Effects networking subsystem Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants