All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix staging:iio:ring_sw: Fix incorrect test on successful read of last value, causes infinite loop
@ 2010-03-30 16:45 Jonathan Cameron
  2010-04-23  0:13 ` patch staging-iio-ring_sw-fix-incorrect-test-on-successful-read-of-last-value-causes-infinite-loop.patch added to gregkh-2.6 tree gregkh
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Cameron @ 2010-03-30 16:45 UTC (permalink / raw)
  To: linux-iio@vger.kernel.org, LKML, Greg Kroah-Hartman


Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---

 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.

 Patch is post the spin lock fix:
 [PATCH] Staging: IIO: Fix uses of spinlocks prior to init in ring implementations


 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 7dff2bf..5abba8c 100644
--- a/drivers/staging/iio/ring_sw.c
+++ b/drivers/staging/iio/ring_sw.c
@@ -296,7 +296,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);
-- 
1.6.4.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* patch staging-iio-ring_sw-fix-incorrect-test-on-successful-read-of-last-value-causes-infinite-loop.patch added to gregkh-2.6 tree
  2010-03-30 16:45 [PATCH] Fix staging:iio:ring_sw: Fix incorrect test on successful read of last value, causes infinite loop Jonathan Cameron
@ 2010-04-23  0:13 ` gregkh
  0 siblings, 0 replies; 2+ messages in thread
From: gregkh @ 2010-04-23  0:13 UTC (permalink / raw)
  To: jic23, gregkh, linux-iio


This is a note to let you know that I've just added the patch titled

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

to my gregkh-2.6 tree.  Its filename is

    staging-iio-ring_sw-fix-incorrect-test-on-successful-read-of-last-val=
ue-causes-infinite-loop.patch

This tree can be found at=20
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patch=
es/


>>From jic23@cam.ac.uk  Thu Apr 22 16:41:09 2010
From: Jonathan Cameron <jic23@cam.ac.uk>
Date: Tue, 30 Mar 2010 17:45:04 +0100
Subject: staging: iio: ring_sw: Fix incorrect test on successful read of =
last value, causes infinite loop
To: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>, Greg Kroah-H=
artman <gregkh@suse.de>
Message-ID: <4BB22A90.6070801@cam.ac.uk>


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 file changed, 1 insertion(+), 1 deletion(-)

--- 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);
=20
-	if (unlikely(ring->last_written_p >=3D last_written_p_copy))
+	if (unlikely(ring->last_written_p !=3D last_written_p_copy))
 		goto again;
=20
 	iio_unmark_sw_rb_in_use(&ring->buf);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-23  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-30 16:45 [PATCH] Fix staging:iio:ring_sw: Fix incorrect test on successful read of last value, causes infinite loop Jonathan Cameron
2010-04-23  0:13 ` patch staging-iio-ring_sw-fix-incorrect-test-on-successful-read-of-last-value-causes-infinite-loop.patch added to gregkh-2.6 tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.