From 83a3b969a39e7df923e341abc3821b8fd59c9a05 Mon Sep 17 00:00:00 2001 From: ligd Date: Tue, 4 Jul 2023 17:24:06 +0800 Subject: [PATCH] rptun: fix use after free caused by API wrong order remove list delete from rptun_dev_stop Signed-off-by: ligd --- drivers/rptun/rptun.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c index 6f6f311683..a266d76a47 100644 --- a/drivers/rptun/rptun.c +++ b/drivers/rptun/rptun.c @@ -765,7 +765,6 @@ static int rptun_dev_stop(FAR struct remoteproc *rproc) /* Remove priv from list */ nxrmutex_lock(&g_rptun_lockcb); - metal_list_del(&priv->node); /* Broadcast device_destroy to all registers */ @@ -786,8 +785,8 @@ static int rptun_dev_stop(FAR struct remoteproc *rproc) /* Remote proc remove */ - remoteproc_remove_virtio(rproc, priv->rvdev.vdev); rpmsg_deinit_vdev(&priv->rvdev); + remoteproc_remove_virtio(rproc, priv->rvdev.vdev); return 0; }