[PATCH 5/5] rpmsg: fix published buffer length in rpmsg_recv_done

Ohad Ben-Cohen ohad at wizery.com
Tue Feb 28 12:21:12 EST 2012


After processing an incoming message, always publish the real size
of its containing buffer when putting it back on the available rx ring.

Using any different value might erroneously limit the remote processor
(leading it to think the buffer is smaller than it really is).

Signed-off-by: Ohad Ben-Cohen <ohad at wizery.com>
Cc: Grant Likely <grant.likely at secretlab.ca>
Cc: Arnd Bergmann <arnd at arndb.de>
Cc: Mark Grosen <mgrosen at ti.com>
Cc: Suman Anna <s-anna at ti.com>
Cc: Fernando Guzman Lugo <fernando.lugo at ti.com>
Cc: Rob Clark <rob at ti.com>
Cc: Ludovic BARRE <ludovic.barre at stericsson.com>
Cc: Loic PALLARDY <loic.pallardy at stericsson.com>
Cc: Omar Ramirez Luna <omar.luna at linaro.org>
---
 drivers/rpmsg/virtio_rpmsg_bus.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 1e8b8b6..f93ca3b 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -798,7 +798,8 @@ static void rpmsg_recv_done(struct virtqueue *rvq)
 	else
 		dev_warn(dev, "msg received with no recepient\n");
 
-	sg_init_one(&sg, msg, sizeof(*msg) + len);
+	/* publish the real size of the buffer */
+	sg_init_one(&sg, msg, RPMSG_BUF_SIZE);
 
 	/* add the buffer back to the remote processor's virtqueue */
 	err = virtqueue_add_buf(vrp->rvq, &sg, 0, 1, msg, GFP_KERNEL);
-- 
1.7.5.4




More information about the linux-arm-kernel mailing list