[PATCH 2.6] ibmveth bug fixes 2/4

From: Santiago Leon
Date: Tue Aug 10 2004 - 13:16:39 EST


Andrew,

This patch fixes a race condition that would panic the kernel when replenishing a buffer pool. Please apply.

Signed-off-by: Santiago Leon <santil@xxxxxxxxxx>

--
Santiago A. Leon
Power Linux Development
IBM Linux Technology Center
===== drivers/net/ibmveth.c 1.14 vs edited =====
--- 1.14/drivers/net/ibmveth.c Tue Aug 10 11:56:29 2004
+++ edited/drivers/net/ibmveth.c Tue Aug 10 11:57:09 2004
@@ -219,6 +219,7 @@

dma_addr = vio_map_single(adapter->vdev, skb->data, pool->buff_size, DMA_FROM_DEVICE);

+ pool->free_map[free_index] = 0xffff;
pool->dma_addr[index] = dma_addr;
pool->skbuff[index] = skb;

@@ -233,6 +234,7 @@
lpar_rc = h_add_logical_lan_buffer(adapter->vdev->unit_address, desc.desc);

if(lpar_rc != H_Success) {
+ pool->free_map[free_index] = index;
pool->skbuff[index] = NULL;
pool->consumer_index--;
vio_unmap_single(adapter->vdev, pool->dma_addr[index], pool->buff_size, DMA_FROM_DEVICE);
@@ -240,7 +242,6 @@
adapter->replenish_add_buff_failure++;
break;
} else {
- pool->free_map[free_index] = 0xffff;
buffers_added++;
adapter->replenish_add_buff_success++;
}