usb: device_next: Fail enqueue on disabled endpoints
Do not allow enqueuing buffers on endpoints that were not enabled. Doing so can lead to division by zero later on because the max packet size can be 0 in disabled endpoint configuration. Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
This commit is contained in:
parent
9006780db4
commit
d39d7e5c60
1 changed files with 5 additions and 0 deletions
|
@ -592,6 +592,11 @@ int udc_ep_enqueue(const struct device *dev, struct net_buf *const buf)
|
|||
goto ep_enqueue_error;
|
||||
}
|
||||
|
||||
if (!cfg->stat.enabled) {
|
||||
ret = -ENODEV;
|
||||
goto ep_enqueue_error;
|
||||
}
|
||||
|
||||
LOG_DBG("Queue ep 0x%02x %p len %u", cfg->addr, buf,
|
||||
USB_EP_DIR_IS_IN(cfg->addr) ? buf->len : buf->size);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue