[openib-general] [PATCH 1 of 5] IB/mthca: fix off-by-one in FMR handling on memfree

ishai ishai at dev.mellanox.co.il
Wed Jan 3 07:57:42 PST 2007


Hi MST and Roland,

There is a chance that this is the core of the 32-bit OS on 64-bit 
platforms bug we had.
I run a certain test (copy 1G size file to the SRP disk) with and 
without this patch.
With the patch I got a panic, and without it the test passed.

Ishai

Michael S. Tsirkin wrote:
> There's an off-by-one in FMR handling on memfree hardware.
>
> Example: assume we have 2 entries in scatterlist, 4K each, offset
> is 4K.  current code will return first entry + 4K, where we
> really want the second entry.
>
> Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
>
> ---
>
> Index: linux-2.6/drivers/infiniband/hw/mthca/mthca_memfree.c
> ===================================================================
> --- linux-2.6.orig/drivers/infiniband/hw/mthca/mthca_memfree.c
> +++ linux-2.6/drivers/infiniband/hw/mthca/mthca_memfree.c
> @@ -232,7 +232,7 @@ void *mthca_table_find(struct mthca_icm_
>  
>  	list_for_each_entry(chunk, &icm->chunk_list, list) {
>  		for (i = 0; i < chunk->npages; ++i) {
> -			if (chunk->mem[i].length >= offset) {
> +			if (chunk->mem[i].length > offset) {
>  				page = chunk->mem[i].page;
>  				goto out;
>  			}
>
>   





More information about the general mailing list