batman-adv: tt: fix TOCTOU race for reported vlans
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 16116dac23396e73c01eeee97b102e4833a4b205 · < 4cc85aec8d3c9ab4dc716dc9f1ed36fca16b227f| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
batman-adv: tt: fix TOCTOU race for reported vlans
The local TT based TVLV is generated by first checking the number of VLANs which have at least one TT entry. A new buffer with the correct size for the VLANs is then allocated. Only then, the list of VLANs s used to fill the VLAN entries in the buffer. During this time, the meshif_vlan_list_lock is held. But the actual number of TT entries of each VLAN can still increase during this time - just not the number of VLANs in the list.
But the prefilter used in the buffer size calculation might still cause an increase of the number of VLANs which need to be stored. Simply because a VLAN might now suddenly have at least one entry when it had none in the pre-alloc check - and then needs to occupy space which was not allocated.
It is better to overestimate the buffer size at the beginning and then fill the buffer only with the VLANs which are not empty.
From the CVE record · Linux
A time-of-check/time-of-use race in batman-adv can leave too little buffer space for VLAN entries when a previously empty VLAN gains a TT entry. The resulting buffer write can exceed the allocated space; the input does not specify whether exploitation requires network or local access, authentication, or user interaction.
Engineers running Linux kernels that include batman-adv should check their kernel’s status; affected versions were not provided.