From: Ohad Ben-Cohen Date: Tue, 28 Feb 2012 14:11:28 +0000 (+0200) Subject: rpmsg: fix published buffer length in rpmsg_recv_done X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=f1d9e9c767f96f57a3cca5304c046f692e115ec9;p=deliverable%2Flinux.git rpmsg: fix published buffer length in rpmsg_recv_done 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 Cc: Grant Likely Cc: Arnd Bergmann Cc: Mark Grosen Cc: Suman Anna Cc: Fernando Guzman Lugo Cc: Rob Clark Cc: Ludovic BARRE Cc: Loic PALLARDY Cc: Omar Ramirez Luna --- diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 1e8b8b618674..f93ca3b8fd42 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);