genodelabs / genode

Genode OS Framework
https://genode.org/
Other
1.06k stars 250 forks source link

usb_host: session component pointer corruption #5349

Open skalk opened 1 week ago

skalk commented 1 week ago

Within the Genode C API for USB host drivers: when processing USB requests a for_each function is used to loop over the open sessions. Due to the fact that certain USB requests (control) may block in the Linux driver ported code, it happens that after de-blocking the next pointer that was cached in the for_each loop is actually invalid. To circumvent this behaviour, we can replace occurrences of for_each in the USB C API code where actually an apply for one fitting instance is needed. Such an additional method does not need to cache the next pointer, and can be used mostly. Only few occurrences of for_each are actually necessary (like destruction use cases), which should not call potentially blocking Linux code.

chelmuth commented 1 week ago

Great, merged to staging instantly.