power: fix sanity checks for guest channel read
authorHongbo Zheng <zhenghongbo3@huawei.com>
Wed, 12 May 2021 02:19:19 +0000 (10:19 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 12 May 2021 15:18:38 +0000 (17:18 +0200)
commit1fe00fd358c0b5cab798010a69e758bfead9fd84
tree1e98763a9fcb4979c3bcfc1b7e80203e827838ea
parent428eaeb822c229d92e287322c80eeb15e0b53351
power: fix sanity checks for guest channel read

In function power_guest_channel_read_msg, 'lcore_id' is used before
validity check, which may cause buffer 'global_fds' accessed by index
'lcore_id' overflow.

This patch moves the validity check of 'lcore_id' before the 'lcore_id'
being used for the first time.

Fixes: 9dc843eb273b ("power: extend guest channel API for reading")
Cc: stable@dpdk.org
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
lib/power/guest_channel.c