From 66b5a7725e91a4530d2ee876aa320a882921a760 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 1 Nov 2020 21:35:10 +0800 Subject: [PATCH] rpmsg: virito: limit the buffer allocate from shared memory pool rpmsg_virtio_get_tx_buffer shouldn't allocate the number of buffer bigger than the virtio ring length of sending Signed-off-by: Xiang Xiao --- lib/rpmsg/rpmsg_virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rpmsg/rpmsg_virtio.c b/lib/rpmsg/rpmsg_virtio.c index f09eae278..4e9561163 100644 --- a/lib/rpmsg/rpmsg_virtio.c +++ b/lib/rpmsg/rpmsg_virtio.c @@ -143,7 +143,7 @@ static void *rpmsg_virtio_get_tx_buffer(struct rpmsg_virtio_device *rvdev, #ifndef VIRTIO_SLAVE_ONLY if (role == RPMSG_MASTER) { data = virtqueue_get_buffer(rvdev->svq, len, idx); - if (!data) { + if (!data && rvdev->svq->vq_free_cnt) { data = rpmsg_virtio_shm_pool_get_buffer(rvdev->shpool, RPMSG_BUFFER_SIZE); *len = RPMSG_BUFFER_SIZE;