]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: nvec: Reject incomplete messages
authorJulian Andres Klode <jak@jak-linux.org>
Tue, 27 Sep 2011 17:01:01 +0000 (19:01 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 30 Sep 2011 00:41:37 +0000 (17:41 -0700)
Reject incomplete messages, causing the request to be
transmitted again. This should fix various problems
out there.

Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/nvec/nvec.c

index e845f58a8d773614eed9d2afcda367d0eedc1808..8c01723d681a38098c1a73af457a38df040b4c66 100644 (file)
@@ -439,11 +439,16 @@ static void nvec_tx_completed(struct nvec_chip *nvec)
  */
 static void nvec_rx_completed(struct nvec_chip *nvec)
 {
-       if (nvec->rx->pos != nvec_msg_size(nvec->rx))
+       if (nvec->rx->pos != nvec_msg_size(nvec->rx)) {
                dev_err(nvec->dev, "RX incomplete: Expected %u bytes, got %u\n",
                           (uint) nvec_msg_size(nvec->rx),
                           (uint) nvec->rx->pos);
 
+               nvec_msg_free(nvec, nvec->rx);
+               nvec->state = 0;
+               return;
+       }
+
        spin_lock(&nvec->rx_lock);
 
        /* add the received data to the work list