Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USBCore SET_CONFIGURATION handler is not interrupt-safe #688

Open
AlanStern opened this issue Dec 4, 2022 · 0 comments
Open

USBCore SET_CONFIGURATION handler is not interrupt-safe #688

AlanStern opened this issue Dec 4, 2022 · 0 comments

Comments

@AlanStern
Copy link

In USBCore.cpp, the handleStandardSetup() interrupt subroutine's SET_CONFIGURATION case calls initEndpoints(), which calls initEP(). For Bulk-OUT endpoints, initEP() calls operator new and possibly operator delete. In the absence of any other information, I assume the implementations of those operators internally rely on malloc() and free(), which are not interrupt-safe.

A proper fix requires a fair amount of reorganization. The DoubleBufferedEPOutHandler class object should be created early, during the initialization of the USB device. When a SET_CONFIGURATION request is received, the object should not be deleted and recreated, but properly reset. (This is related to issue #350, although the problem was present before that.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant