Skip to content

Commit

Permalink
net: ipa: initialize all filter table slots
Browse files Browse the repository at this point in the history
There is an off-by-one problem in ipa_table_init_add(), when
initializing filter tables.

In that function, the number of filter table entries is determined
based on the number of set bits in the filter map.  However that
count does *not* include the extra "slot" in the filter table that
holds the filter map itself.  Meanwhile, ipa_table_addr() *does*
include the filter map in the memory it returns, but because the
count it's provided doesn't include it, it includes one too few
table entries.

Fix this by including the extra slot for the filter map in the count
computed in ipa_table_init_add().

Note: ipa_filter_reset_table() does not have this problem; it resets
filter table entries one by one, but does not overwrite the filter
bitmap.

Fixes: 2b9feef ("soc: qcom: ipa: filter and routing tables")
Signed-off-by: Alex Elder <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Alex Elder authored and davem330 committed Sep 8, 2021
1 parent ea269a6 commit b5c1022
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ipa/ipa_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ static void ipa_table_init_add(struct gsi_trans *trans, bool filter,
* table region determines the number of entries it has.
*/
if (filter) {
count = hweight32(ipa->filter_map);
/* Include one extra "slot" to hold the filter map itself */
count = 1 + hweight32(ipa->filter_map);
hash_count = hash_mem->size ? count : 0;
} else {
count = mem->size / sizeof(__le64);
Expand Down

0 comments on commit b5c1022

Please sign in to comment.