The inp returned by in_pcblookup_local() can be detached. So check if inp_socket is not NULL before dereferencing it.
This issue was reported by syzkaller and introduced in e3ba0d6adde3.
Details
Details
Run the reproducer found by syzkaller.
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
sys/netinet/in_pcb.c | ||
---|---|---|
957 | We don't hold t's lock here, so what prevents inp_socket from being set to NULL after this check? |
Comment Actions
Adding just an INP_RLOCK(t)/INP_UNLOCK(t) does not resolve the issue. First, it introduces an LOR, since we own the inp hash lock, second the system panics elsewhere when testing with reproducer. The current patch (with the missing locks) mitigates the issue found by syzkaller, but is conceptually not correct due to missing locks. Gleb?