David Gibson 5826cade43 [PATCH] ibmveth: Fix index increment calculation
On Thu, Oct 12, 2006 at 06:22:14PM +1000, David Gibson wrote:
> Your recent ibmveth commit, 751ae21c6cd1493e3d0a4935b08fb298b9d89773
> ("fix int rollover panic"), causes a rapid oops on my test machine
> (POWER5 LPAR).
>
> I've bisected it down to that commit, but am still investigating the
> cause of the crash itself.

Found the problem, I believe: an object lesson in the need for great
caution using ++.

[...]
@@ -213,6 +213,7 @@ static void ibmveth_replenish_buffer_poo
 		}

 		free_index = pool->consumer_index++ % pool->size;
+		pool->consumer_index = free_index;
 		index = pool->free_map[free_index];

 		ibmveth_assert(index != IBM_VETH_INVALID_MAP);

Since the ++ is used as post-increment, the increment is not included
in free_index, and so the added line effectively reverts the
increment.  The produced_index side has an analagous bug.

The following change corrects this:

The recent commit 751ae21c6cd1493e3d0a4935b08fb298b9d89773 introduced
a bug in the producer/consumer index calculation in the ibmveth driver
- incautious use of the post-increment ++ operator resulted in an
increment being immediately reverted.  This patch corrects the logic.

Without this patch, the driver oopses almost immediately after
activation on at least some machines.

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-21 14:34:21 -04:00
..
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-10-07 10:51:14 -07:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-10-11 03:56:33 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-10-08 12:32:36 -07:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-10-06 15:03:04 -04:00
2006-09-13 13:24:59 -04:00
2006-08-19 17:40:16 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-10-21 14:20:02 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-28 18:01:44 -07:00
2006-09-24 20:07:48 -07:00
2006-10-10 16:15:34 -07:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-10-11 04:06:09 -04:00
2006-10-21 14:08:24 -04:00
2006-10-17 10:24:25 -07:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00
2006-10-07 10:51:15 -07:00
2006-10-11 11:17:06 -07:00
2006-10-11 11:17:06 -07:00
2006-09-13 13:24:59 -04:00
2006-09-28 18:01:42 -07:00
2006-09-13 13:24:59 -04:00
2006-09-13 13:24:59 -04:00