Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3232952imu; Sat, 24 Nov 2018 00:41:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/U4P7qyG0sL93MgwBZ2nxQfN/Wku0/CzNB1RJLwUHLV2XAsA51i4o/nPFGl0+qGM4OqFPPX X-Received: by 2002:a65:5a8e:: with SMTP id c14mr17042705pgt.137.1543048901264; Sat, 24 Nov 2018 00:41:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543048901; cv=none; d=google.com; s=arc-20160816; b=iPsewRu2XEKRkv6iFDKZr/1C36CRTl9wtLl2RqqdfhMcvbhIloVZMLTiJNyrXGJN10 j4JfpmQ1D1ZP/tlZQu8w7Zs3/PEp2gu4Nfs0NbybNHV6Pg8MiwsL9PaQl84XLFcf8zP5 fsArO/dHVk/amTcZ7rj+J73eSaEm1/DFDeO0tOXx7e8W09ajneyHZbXavY8WUSkf4ssp hJ4nWqwfVfdZYJwEeNTBc8EBOHnA2gh6KFVF1bvvNI/+wl/R8/KrebkS6qQD/FVvW92m CUTQuyIwEjLf35N4Jn9vJcSfugXhlOL/nXYU5/Jroz5q37oDbTNceDIkFoepK+wbyCyP dOHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=z+AOmfUCen5ycD5XHwgob46GNY/jF3mwH4OGfC8YsRA=; b=M19x8zn39yPnj7GDNt8A8s1oRc+ZbW8MGH8ZYQQilJuiZQZF3HCRCDuK9cFpvS3xLq pRouy1wd4FDbT67xCegowbI65IKKylsdt/9KfWnzemR3cvKVz32kyC/jG9ocaDpQo86s Z1pwsfxfDRo/v3gb61ErSMU7WOgGHM3+qEdzVvgPsmm6h29qQz+x5HvlETqVdPgpm70J 1jcGZXDzQQEhRFUp52KZzwBGh1FrYvKjmrFiqMPXlFSSjmXQw+Po7aYImZAkqdyYWF1C QaTynY7bLdactxfq+NqtxGahVTDoI4F/RtLb2Ene7FGzAB+lyn7ZsOQDk9CHv480rsTN lt7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y40-v6si58686548pla.391.2018.11.24.00.41.26; Sat, 24 Nov 2018 00:41:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2632860AbeKXCz2 (ORCPT + 99 others); Fri, 23 Nov 2018 21:55:28 -0500 Received: from relay.sw.ru ([185.231.240.75]:47850 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388714AbeKXCz2 (ORCPT ); Fri, 23 Nov 2018 21:55:28 -0500 Received: from [10.94.4.83] (helo=finist-ce7.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gQE2I-0003fC-Kq; Fri, 23 Nov 2018 19:10:30 +0300 From: Konstantin Khorenko To: Jeff Kirsher Cc: Konstantin Khorenko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, "David S . Miller" Subject: [PATCH 1/1] drivers/net/i40e: define proper net_device::neigh_priv_len Date: Fri, 23 Nov 2018 19:10:28 +0300 Message-Id: <20181123161028.22633-2-khorenko@virtuozzo.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20181123161028.22633-1-khorenko@virtuozzo.com> References: <20181123161028.22633-1-khorenko@virtuozzo.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 21c2688d6308..539b8f3738e6 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -12334,6 +12334,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.15.1