patrickelectric opened a new pull request, #22531:
URL: https://github.com/apache/nuttx/pull/22531

   ## Summary
   
   stm32_epfreepma() set the buffer bit in epavail instead of bufavail, so the 
buffer leaked and a random endpoint was marked free.
   
   ## Impact
   
   Fix ep/buf allocation for H5. DEV_ALLOCEP just fails without it.
   
   ## Testing
   
   With fix:
   ```
   nsh> usbfs alloc 20
   round 1 allocated=4
   round 2 allocated=4
   round 3 allocated=4
   round 4 allocated=4
   round 5 allocated=4
   round 6 allocated=4
   round 7 allocated=4
   round 8 allocated=4
   round 9 allocated=4
   round 10 allocated=4
   round 11 allocated=4
   round 12 allocated=4
   round 13 allocated=4
   round 14 allocated=4
   round 15 allocated=4
   round 16 allocated=4
   round 17 allocated=4
   round 18 allocated=4
   round 19 allocated=4
   round 20 allocated=4
   nsh> usbfs ep
   ep0 addr=0 type=ctrl in=nak/buf1 out=valid/buf0
   ep1 addr=1 type=bulk in=nak/buf2 out=valid/buf3
   ep2 addr=2 type=intr in=nak/buf4
   ep3 addr=3 type=bulk in=nak/buf5 out=valid/buf6
   ep4 addr=4 type=intr in=nak/buf7
   ep5 addr=5 type=bulk in=nak/buf8 out=valid/buf9
   ep6 addr=6 type=bulk in=nak/buf10 out=valid/buf11
   summary endpoints=10 numbers=6 shared=4 maxbuf=11
   ```
   
   Without fix:
   ```
   nsh> usbfs alloc 20
   round 1 allocated=0
   ```
   
   Tested in stm32h563


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to