mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
tls_device_down() moves each context to tls_device_down_list while
holding tls_device_lock. It then drops its reference and removes the
context after releasing the lock.
tls_device_queue_ctx_destruction() removes contexts from the same list
under tls_device_lock. If it removes an adjacent context while
tls_device_down() is deleting its node, the two list updates can
interleave. One update can then target a context freed by the other path,
causing a use-after-free write.
Drop the reference and remove the context in the existing
tls_device_lock critical section. Keep tls_device_free_ctx() after
releasing the lock.
This issue was found with a static analysis tool.
Fixes: f6336724a4 ("net/tls: Remove the context from the list in tls_device_down")
Cc: [email protected]
Signed-off-by: Jaeyeong Lee <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>