staging: iio: ring_sw: Fix incorrect test on successful read of last value, causes infinite loop

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, April 30, 2010 - 10:59 am

Gitweb:     http://git.kernel.org/linus/4845187b39b79e3c1d4474c2767ddc7fb493eb05
Commit:     4845187b39b79e3c1d4474c2767ddc7fb493eb05
Parent:     a8947fcf3bbeda9fc6ff1205e51f8ff1b0128cc4
Author:     Jonathan Cameron <jic23@cam.ac.uk>
AuthorDate: Tue Mar 30 17:45:04 2010 +0100
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Fri Apr 30 09:30:09 2010 -0700

    staging: iio: ring_sw: Fix incorrect test on successful read of last value, causes infinite loop
    
    This is a bad one. The test means that almost no reads of the last
    value ever succeed!  Result is an infinite loop.
    
    Another one for the 'oops' category.
    
    Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/iio/ring_sw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/ring_sw.c b/drivers/staging/iio/ring_sw.c
index b104c3d..cf22c09 100644
--- a/drivers/staging/iio/ring_sw.c
+++ b/drivers/staging/iio/ring_sw.c
@@ -293,7 +293,7 @@ again:
 		return -EAGAIN;
 	memcpy(data, last_written_p_copy, ring->buf.bpd);
 
-	if (unlikely(ring->last_written_p >= last_written_p_copy))
+	if (unlikely(ring->last_written_p != last_written_p_copy))
 		goto again;
 
 	iio_unmark_sw_rb_in_use(&ring->buf);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
staging: iio: ring_sw: Fix incorrect test on successful re ..., Linux Kernel Mailing ..., (Fri Apr 30, 10:59 am)