aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/sn
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2009-08-25 14:54:10 -0400
committerTony Luck <tony.luck@intel.com>2009-09-15 11:40:49 -0400
commit9b6b93998a0d9c44d6701be5b472f3302c3a8596 (patch)
tree7cdea412d44e7b3ee507422df513f74c53d2430f /arch/ia64/sn
parent0cced40e7c58b1105aef3ca446da7b158a18a9a6 (diff)
[IA64] pci_br, fix infinite loop in find_free_ate()
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>
Diffstat (limited to 'arch/ia64/sn')
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_ate.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_ate.c b/arch/ia64/sn/pci/pcibr/pcibr_ate.c
index 239b3cedcf2b..5bc34eac9e01 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_ate.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_ate.c
@@ -54,6 +54,8 @@ static int find_free_ate(struct ate_resource *ate_resource, int start,
54 break; 54 break;
55 } 55 }
56 } 56 }
57 if (i >= ate_resource->num_ate)
58 return -1;
57 } else 59 } else
58 index++; /* Try next ate */ 60 index++; /* Try next ate */
59 } 61 }