(Linux, 05/01/07, Michael S. Tsirkin, commit:
46707e96b7254663139225ab6c9ab9922cd8c435)
mthca_table_find() will return the wrong address when the table entry
being searched for is exactly at the beginning of a sglist entry
(other than the first), because it uses >= when it should use >.
Example: assume we have 2 entries in scatterlist, 4K each, offset is
4K. The current code will return first entry + 4K when we really want
the second entry.
In particular this means mapping an FMR on a memfree HCA may end up
writing the page table into the wrong place, leading to memory
corruption and also causing the HCA to use an incorrect address
translation table.
git-svn-id: svn://openib.tc.cornell.edu/gen1@1507
ad392aa1-c5ef-ae45-8dd8-
e69d62a5ef86
list_for_each_entry(chunk, &icm->chunk_list, list,struct mthca_icm_chunk) {
for (i = 0; i < chunk->npages; ++i) {
- if ((int)chunk->mem[i].length >= offset) {
+ if ((int)chunk->mem[i].length > offset) {
page = chunk->mem[i].page;
goto out;
}