Description
In the Linux kernel, the following vulnerability has been resolved: tcp: ipv6: free ireq->ipv6_opt after an RCU grace period ireq->ipv6_opt is only set by calipso_req_setattr(), when a CALIPSO NetLabel mapping is configured. Request socket migration (net.ipv4.tcp_migrate_req=1, or a BPF_SK_REUSEPORT_SELECT_OR_MIGRATE program) clones the request socket with inet_reqsk_clone(), so that the old request socket and its clone share the same ipv6_opt, then reqsk_migrate_reset() clears the pointer in the old one. Another cpu holding a reference on the old request socket can still be using these options, sending a SYNACK from tcp_v6_send_synack() or creating a child in tcp_v6_syn_recv_sock(), when the clone is freed. tcp_v6_reqsk_destructor() frees ipv6_opt with a plain kfree(), leading to a use-after-free. Both readers already run under RCU, like their IPv4 counterparts. Use kfree_rcu() in tcp_v6_reqsk_destructor(), as commit e3f33b0a1d89 ("ipv4: free inet_opt and ireq_opt after an RCU grace period") did for ireq_opt.
Affected products
Version statuses are supplied by the assigning organization. Consult the original record for detailed ranges and platform conditions.
Linux Linux
Default version status: unaffected
c905dee62232db583b50fe214080b98db623151e to < e1952acabcf9bf5b93150a38837b573186e0e299affectedc905dee62232db583b50fe214080b98db623151e to < 929a2b016ba9ba9c859a65038e212d2ce0ceee36affectedc905dee62232db583b50fe214080b98db623151e to < 14f121b0dcd845b50bfc3baa98443f39c08b91afaffectedc905dee62232db583b50fe214080b98db623151e to < 82378cf642bd722d552c200e40aca1596b12d132affectedc905dee62232db583b50fe214080b98db623151e to < fafbc4051123d5459ea6950899cec08ed946e278affected
Linux Linux
Default version status: affected
5.14affected0 to < 5.14unaffected5.15.227 to ≤ 5.15.*unaffected6.12.120 to ≤ 6.12.*unaffected6.18.66 to ≤ 6.18.*unaffected7.3.7 to ≤ 7.3.*unaffected7.4-rc2 to ≤ *unaffected
References
- https://git.kernel.org/stable/c/e1952acabcf9bf5b93150a38837b573186e0e299 ↗
- https://git.kernel.org/stable/c/929a2b016ba9ba9c859a65038e212d2ce0ceee36 ↗
- https://git.kernel.org/stable/c/14f121b0dcd845b50bfc3baa98443f39c08b91af ↗
- https://git.kernel.org/stable/c/82378cf642bd722d552c200e40aca1596b12d132 ↗
- https://git.kernel.org/stable/c/fafbc4051123d5459ea6950899cec08ed946e278 ↗