Skip to content

Commit

Permalink
[IA64] pci_br, fix infinite loop in find_free_ate()
Browse files Browse the repository at this point in the history
When
* there is almost out of ates
* one asks for more than one ate
* there are some available at the end of ate array
then the inner for loop will end without incrementing 'index'. This
means the outer loop will start at the same point finding it's available
and runs the inner loop again from the same index. This repeats forever.

Hence make sure we check we were at the end of ate array and return
an error in such case.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Found-by: Jeff Mahoney <jeffm@novell.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
  • Loading branch information
Jiri Slaby authored and Tony Luck committed Sep 15, 2009
1 parent 0cced40 commit 9b6b939
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/ia64/sn/pci/pcibr/pcibr_ate.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ static int find_free_ate(struct ate_resource *ate_resource, int start,
break;
}
}
if (i >= ate_resource->num_ate)
return -1;
} else
index++; /* Try next ate */
}
Expand Down

0 comments on commit 9b6b939

Please sign in to comment.