mempool: fix corruption due to invalid handler
authorWeiliang Luo <droidluo@gmail.com>
Thu, 8 Sep 2016 15:29:57 +0000 (10:29 -0500)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 16 Sep 2016 14:16:37 +0000 (16:16 +0200)
commite15922d75a8226a0a5af97d39a9f15a2e6163e9d
treeeda077a87372778493faba38fb75f22795909f99
parentda5d107207910fc318862579e7b588481c72c668
mempool: fix corruption due to invalid handler

When using rte_mempool_create(), the mempool handler is selected
depending on the flags given by the user:
  - multi-consumer / multi-producer
  - multi-consumer / single-producer
  - single-consumer / multi-producer
  - single-consumer / single-producer

The flags were not properly tested, resulting in the selection of sc/sp
handler if sc/mp or mc/sp was asked. This can lead to corruption or
crashes because the get/put operations are not atomic.

Fixes: 449c49b93a6b ("mempool: support handler operations")

Signed-off-by: Weiliang Luo <droidluo@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
lib/librte_mempool/rte_mempool.c