ivshmem: avoid infinite loop when concatenating segments
authorAnatoly Burakov <anatoly.burakov@intel.com>
Thu, 7 Apr 2016 11:00:00 +0000 (12:00 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 7 Apr 2016 17:23:44 +0000 (19:23 +0200)
commitd6cf31419e5109a060dc704f92ca32fe7a351be9
tree59a16a205e05fe3a784b9d7437d920e7c21565ae
parent7d788417543c5a2e61504c11dea228bd2378c46d
ivshmem: avoid infinite loop when concatenating segments

This patch aligns the logic used to check for the presence of
adjacent segments in has_adjacent_segments() with the logic used
in cleanup_segments() when actually deciding to concatenate or
not a pair of segments. Additionally, adjacent segments are
no longer considered overlapping to avoid generating errors for
segments that can happily coexist together.

This fixes an infinite loop that happened when segments where
adjacent in their physical or virtual addresses but not in their
ioremap addresses: has_adjacent_segments() reported the presence
of adjacent segments while cleanup_segments() was not considering
them for concatenation, resulting in an infinite loop since the
result of has_adjacent_segments() is used in the decision to
continue looping in cleanup_segments().

Signed-off-by: David Verbeiren <david.verbeiren@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/librte_eal/linuxapp/eal/eal_ivshmem.c