This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 019f37c13599a459c7807f6dbd48af1c5ee70527 Author: likun17 <[email protected]> AuthorDate: Fri Apr 3 14:17:44 2026 +0800 drivers/sensors/sensor_rpmsg: Cancel works before freeing the endpoint. sensor_rpmsg_device_ns_bound() queues sre->bound_work, and published data is sent from sre->work. If the remote core releases the endpoint before the work runs, sensor_rpmsg_ept_release() frees sre while the work still uses it. Cancel both works and release a pending tx buffer before freeing sre. Signed-off-by: likun17 <[email protected]> --- drivers/sensors/sensor_rpmsg.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/sensors/sensor_rpmsg.c b/drivers/sensors/sensor_rpmsg.c index 61bba3c58d6..ac1fb538b2f 100644 --- a/drivers/sensors/sensor_rpmsg.c +++ b/drivers/sensors/sensor_rpmsg.c @@ -1675,6 +1675,16 @@ static void sensor_rpmsg_ept_release(FAR struct rpmsg_endpoint *ept) up_write(&g_ept_lock); + work_cancel_sync(HPWORK, &sre->bound_work); + work_cancel_sync(HPWORK, &sre->work); + nxrmutex_lock(&sre->lock); + if (sre->buffer) + { + rpmsg_release_tx_buffer(&sre->ept, sre->buffer); + sre->buffer = NULL; + } + + nxrmutex_unlock(&sre->lock); nxrmutex_destroy(&sre->lock); kmm_free(sre); }
