Skip to content

HWCDC::end() does not set tx_lock to NULL, causing crashes #8224

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

Closed
1 task done
TD-er opened this issue May 18, 2023 · 2 comments · Fixed by #8247
Closed
1 task done

HWCDC::end() does not set tx_lock to NULL, causing crashes #8224

TD-er opened this issue May 18, 2023 · 2 comments · Fixed by #8247
Assignees
Labels
Chip: ESP32-C3 Issue is related to support of ESP32-C3 Chip Chip: ESP32-S3 Issue is related to support of ESP32-S3 Chip Status: Needs investigation We need to do some research before taking next steps on this issue Type: Bug 🐛 All bugs

Comments

@TD-er
Copy link
Contributor

TD-er commented May 18, 2023

Board

ESP32-C3 / ESP32-S3

Device Description

Any ESP32-C3 or -S3 using HWCDC

Hardware Configuration

Any ESP32-C3 or -S3 board using HWCDC

Version

v2.0.9

IDE Name

PlatformIO

Operating System

Windows 11

Flash frequency

40MHz

PSRAM enabled

yes

Upload speed

115200

Description

HWCDC::end() does not reset the semaphore.
So after a call to end() and a new call to begin() the tx_lock semaphore is invalid.
Thus trying to write something to that port again will cause a crash.

void HWCDC::end()
{
//Disable tx/rx interrupt.
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
esp_intr_free(intr_handle);
intr_handle = NULL;
if(tx_lock != NULL) {
vSemaphoreDelete(tx_lock);
}
setRxBufferSize(0);
setTxBufferSize(0);
if (arduino_hw_cdc_event_loop_handle) {
esp_event_loop_delete(arduino_hw_cdc_event_loop_handle);
arduino_hw_cdc_event_loop_handle = NULL;
}
}

Sketch

-

Debug Message

-

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@TD-er TD-er added the Status: Awaiting triage Issue is waiting for triage label May 18, 2023
@SuGlider SuGlider self-assigned this May 18, 2023
@SuGlider
Copy link
Collaborator

Thanks @TD-er - I'll check it and fix it.

@SuGlider SuGlider added Type: Bug 🐛 All bugs Chip: ESP32-C3 Issue is related to support of ESP32-C3 Chip Chip: ESP32-S3 Issue is related to support of ESP32-S3 Chip Status: Needs investigation We need to do some research before taking next steps on this issue and removed Status: Awaiting triage Issue is waiting for triage labels May 18, 2023
@SuGlider
Copy link
Collaborator

Thanks again @TD-er - PR #8247 will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chip: ESP32-C3 Issue is related to support of ESP32-C3 Chip Chip: ESP32-S3 Issue is related to support of ESP32-S3 Chip Status: Needs investigation We need to do some research before taking next steps on this issue Type: Bug 🐛 All bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants