diff --git a/[refs] b/[refs] index 1c34b5e7f0d4..3e98be7b9ae3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4e7f79511e7332ae4056eda9156a0299511ea41e +refs/heads/master: 993284dfff3ba4643f08b592427d0ac758d30156 diff --git a/trunk/drivers/net/sfc/filter.c b/trunk/drivers/net/sfc/filter.c index abc884d09d57..52cb6082b910 100644 --- a/trunk/drivers/net/sfc/filter.c +++ b/trunk/drivers/net/sfc/filter.c @@ -20,6 +20,12 @@ #define FILTER_CTL_SRCH_FUDGE_WILD 3 #define FILTER_CTL_SRCH_FUDGE_FULL 1 +/* Hard maximum hop limit. Hardware will time-out beyond 200-something. + * We also need to avoid infinite loops in efx_filter_search() when the + * table is full. + */ +#define FILTER_CTL_SRCH_MAX 200 + struct efx_filter_table { u32 offset; /* address of table relative to BAR */ unsigned size; /* number of entries */ @@ -183,7 +189,8 @@ static int efx_filter_search(struct efx_filter_table *table, incr = efx_filter_increment(key); for (depth = 1, filter_idx = hash & (table->size - 1); - test_bit(filter_idx, table->used_bitmap); + depth <= FILTER_CTL_SRCH_MAX && + test_bit(filter_idx, table->used_bitmap); ++depth) { cmp = &table->spec[filter_idx]; if (efx_filter_equal(spec, cmp)) @@ -192,6 +199,8 @@ static int efx_filter_search(struct efx_filter_table *table, } if (!for_insert) return -ENOENT; + if (depth > FILTER_CTL_SRCH_MAX) + return -EBUSY; found: *depth_required = depth; return filter_idx;