i40e: define proper net_device::neigh_priv_len
authorKonstantin Khorenko <khorenko@virtuozzo.com>
Fri, 23 Nov 2018 16:10:28 +0000 (19:10 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:44:57 +0000 (19:44 +0100)
commit5037c6ff109d72d6a7b33ae4b8f78a5279f080d0
treecb938d612ce56bf2e49903197c3c0ff0ab8e8ded
parent06df6307c6e4a6735be96ee515b9a80f3a9ae051
i40e: define proper net_device::neigh_priv_len

[ Upstream commit 31389b53b3e0b535867af9090a5d19ec64768d55 ]

Out of bound read reported by KASan.

i40iw_net_event() reads unconditionally 16 bytes from
neigh->primary_key while the memory allocated for
"neighbour" struct is evaluated in neigh_alloc() as

  tbl->entry_size + dev->neigh_priv_len

where "dev" is a net_device.

But the driver does not setup dev->neigh_priv_len and
we read beyond the neigh entry allocated memory,
so the patch in the next mail fixes this.

Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/i40e/i40e_main.c