Skip to content

Commit

Permalink
rpmsg_virtio: fix rpmsg_service memory leak when stop remote
Browse files Browse the repository at this point in the history
Rpmsg service may malloc memory in the rpmsg bind callback(): rdev->ns_bind_cb()
When stop remote, the remote may not send RPMSG_NS_DESTROY message back
(baceause the remote may has crashed), so call the unbind callback in
rpmsg_deinit_vdev() to aviod potential memroy leak in rpmsg services.

Signed-off-by: Yin Tao <yintao@xiaomi.com>
  • Loading branch information
Yin Tao authored and CV-Bowen committed Oct 17, 2023
1 parent cd88238 commit 6607149
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ void rpmsg_deinit_vdev(struct rpmsg_virtio_device *rvdev)
node = rdev->endpoints.next;
ept = metal_container_of(node, struct rpmsg_endpoint, node);
rpmsg_destroy_ept(ept);
if (ept->ns_unbind_cb)
ept->ns_unbind_cb(ept);
}

rvdev->rvq = 0;
Expand Down

0 comments on commit 6607149

Please sign in to comment.