rpmsg: fix rpmsg_router_hub_unbind crash when reconnect

0x106b9ad2 in metal_list_del (node=<optimized out>) at /home/yintao/O61/nuttx/include/metal/list.h:85
rpmsg_unregister_endpoint (ept=0x1857ba30) at open-amp/lib/rpmsg/rpmsg.c:296
rpmsg_destroy_ept (ept=0x1857ba30) at open-amp/lib/rpmsg/rpmsg.c:389
0x102b871a in rpmsg_router_hub_unbind (ept=0x1857b330) at rpmsg/rpmsg_router_hub.c:139
0x102b7fec in rpmsg_device_destory (rpmsg=rpmsg@entry=0x1859e4e8) at rpmsg/rpmsg.c:486
0x102b9928 in rpmsg_port_unregister (port=port@entry=0x1859e4e8) at rpmsg/rpmsg_port.c:749
0x102b9bca in rpmsg_port_spi_process_packet (rxhdr=0x185ba718, rpspi=<optimized out>) at rpmsg/rpmsg_port_spi.c:408
rpmsg_port_spi_thread (argc=<optimized out>, argv=<optimized out>) at rpmsg/rpmsg_port_spi.c:452
0x102aa96e in nxtask_start () at task/task_start.c:111

Signed-off-by: yintao <yintao@xiaomi.com>
This commit is contained in:
yintao
2024-12-10 21:14:15 +08:00
committed by Xiang Xiao
parent 773db122a3
commit ad08484cdb
+10 -1
View File
@@ -138,7 +138,16 @@ static void rpmsg_router_hub_unbind(FAR struct rpmsg_endpoint *ept)
if (dst_ept)
{
rpmsg_destroy_ept(dst_ept);
/* Possible failure to execute create_ept at rpmsg_router_hub_bound */
if (dst_ept->cb)
{
rpmsg_destroy_ept(dst_ept);
}
else
{
kmm_free(dst_ept);
}
}
/* Destroy source edge ept */