]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
hv: kvp: Avoid reading past allocated blocks from KVP file
authorPaul Meyer <Paul.Meyer@microsoft.com>
Thu, 15 Mar 2018 19:44:00 +0000 (20:44 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 28 Mar 2018 10:05:33 +0000 (12:05 +0200)
commit2c290ba44cd82e3a5396b2950c672985d7416b5f
tree1f3d61a10c2c38035aa5a6b490f3115973bcfa44
parenta01555037a4832be08397d0f4055811ef9688228
hv: kvp: Avoid reading past allocated blocks from KVP file

BugLink: http://bugs.launchpad.net/bugs/1750349
While reading in more than one block (50) of KVP records, the allocation
goes per block, but the reads used the total number of allocated records
(without resetting the pointer/stream). This causes the records buffer to
overrun when the refresh reads more than one block over the previous
capacity (e.g. reading more than 100 KVP records whereas the in-memory
database was empty before).

Fix this by reading the correct number of KVP records from file each time.

Signed-off-by: Paul Meyer <Paul.Meyer@microsoft.com>
Signed-off-by: Long Li <longli@microsoft.com>
Cc: stable@vger.kernel.org
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 297d6b6e56c2977fc504c61bbeeaa21296923f89)
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
tools/hv/hv_kvp_daemon.c