5bc3c265cb
During initialization of rte_table_hash_ext and rte_table_hash_lru, a contiguous region of memory is allocated to store meta data, buckets, extended buckets, keys, stack of keys, stack of extended buckets and data entries. The size of each region depends on the hash table configuration. The address of each region is calculated using offsets relative to the beginning of the memory region. Without this patch, the offsets contain the size of the table meta data (sizeof(struct rte_table_hash)). These addresses are stored in pointers which are used when entries are added or deleted and lookups are performed. Instead of adding these offsets to the address of the beginning of the memory region, they are added to the address of the end of the meta data (= address of the beginning of the memory region + sizeof(struct rte_table_hash)). The resulting addresses are off by sizeof(struct rte_table_hash) bytes. As a consequence, memory past the allocated region can be accessed by the add, delete and lookup operations. This patch corrects the address calculation by not including the size of the meta data in the offsets. Signed-off-by: Balazs Nemeth <balazs.nemeth@intel.com> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>