From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D8BAC169C4 for ; Mon, 11 Feb 2019 15:41:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7EB6222A8 for ; Mon, 11 Feb 2019 15:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549899674; bh=PWokfIq+ie3sQWDvortYBqD9sb0SCK4lB/h9q/qTQyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=o5FImLr0G9suvtb+YefMgH201ysjt8UJASlrxi3Il3fW+spmwM1xoc6jvzF73O8z9 glJy1WD/eUFSwvyaGVeTOJ6fjo02j4oEpqLTFYyMlhvQ+7Afdn43+oWFTn/euJ2XCs a8RyWa6/Iv+zH7Kh7CXhU90DAyv6DSR4mbM4AoOM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387625AbfBKOsD (ORCPT ); Mon, 11 Feb 2019 09:48:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:33182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732353AbfBKOr7 (ORCPT ); Mon, 11 Feb 2019 09:47:59 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A168206BA; Mon, 11 Feb 2019 14:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896479; bh=PWokfIq+ie3sQWDvortYBqD9sb0SCK4lB/h9q/qTQyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OMGs4cAdkUTAPhKTWUKCP1tZwvDHbrSmjQ0XpDbUfVwfVuYDuNUrpFq8ZVWKL9+sb vMOlouyyZ38w8gwmz3S6az8m3OHSIfOwa15P/ENfd3u6+0P1ln97S0Nl+QMzxiDAOU QRUvz7zwK0wcjMGPCLfKcJZal4OomtCtaGUqgPYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Khorenko , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.19 198/313] i40e: define proper net_device::neigh_priv_len Date: Mon, 11 Feb 2019 15:17:58 +0100 Message-Id: <20190211141906.437166867@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141852.749630980@linuxfoundation.org> References: <20190211141852.749630980@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index bfa5c525cf31..41fa22c562c1 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -12016,6 +12016,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ether_addr_copy(netdev->dev_addr, mac_addr); ether_addr_copy(netdev->perm_addr, mac_addr); + /* i40iw_net_event() reads 16 bytes from neigh->primary_key */ + netdev->neigh_priv_len = sizeof(u32) * 4; + netdev->priv_flags |= IFF_UNICAST_FLT; netdev->priv_flags |= IFF_SUPP_NOFCS; /* Setup netdev TC information */ -- 2.19.1