Skip to content

Commit 8181b2f

Browse files
finist0gregkh
authored andcommitted
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>
1 parent 74b86d3 commit 8181b2f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9772,6 +9772,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
97729772
ether_addr_copy(netdev->dev_addr, mac_addr);
97739773
ether_addr_copy(netdev->perm_addr, mac_addr);
97749774

9775+
/* i40iw_net_event() reads 16 bytes from neigh->primary_key */
9776+
netdev->neigh_priv_len = sizeof(u32) * 4;
9777+
97759778
netdev->priv_flags |= IFF_UNICAST_FLT;
97769779
netdev->priv_flags |= IFF_SUPP_NOFCS;
97779780
/* Setup netdev TC information */

0 commit comments

Comments
 (0)