Skip to content

Commit

Permalink
rpmsg: fix published buffer length in rpmsg_recv_done
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Mark Grosen <[email protected]>
Cc: Suman Anna <[email protected]>
Cc: Fernando Guzman Lugo <[email protected]>
Cc: Rob Clark <[email protected]>
Cc: Ludovic BARRE <[email protected]>
Cc: Loic PALLARDY <[email protected]>
Cc: Omar Ramirez Luna <[email protected]>
  • Loading branch information
ohadbc committed Feb 28, 2012
1 parent 9648224 commit f1d9e9c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/rpmsg/virtio_rpmsg_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f1d9e9c

Please sign in to comment.