rpmsg: glink: Set tail pointer to 0 at end of FIFO
authorChris Lew <clew@codeaurora.org>
Thu, 28 Jun 2018 01:19:57 +0000 (18:19 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Dec 2019 10:04:36 +0000 (11:04 +0100)
commit 4623e8bf1de0b86e23a56cdb39a72f054e89c3bd upstream.

When wrapping around the FIFO, the remote expects the tail pointer to
be reset to 0 on the edge case where the tail equals the FIFO length.

Fixes: caf989c350e8 ("rpmsg: glink: Introduce glink smem based transport")
Cc: stable@vger.kernel.org
Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rpmsg/qcom_glink_smem.c

index 4238383d8685ac6ae8406b8687a37f2eed25bcda..579bc4443f6dbf093c7144b6fa5ef2b249b67804 100644 (file)
@@ -105,7 +105,7 @@ static void glink_smem_rx_advance(struct qcom_glink_pipe *np,
        tail = le32_to_cpu(*pipe->tail);
 
        tail += count;
-       if (tail > pipe->native.length)
+       if (tail >= pipe->native.length)
                tail -= pipe->native.length;
 
        *pipe->tail = cpu_to_le32(tail);