Received: by 10.192.165.156 with SMTP id m28csp33931imm; Tue, 10 Apr 2018 15:49:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx480LwALVyFmCuM59KhiK/uL8FmrPJmKB0yBGKT73Y4wbva5QiPJ8A1GR63aYZ1bbZ98mP0W X-Received: by 2002:a17:902:9a9:: with SMTP id 38-v6mr2343227pln.40.1523400594262; Tue, 10 Apr 2018 15:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400594; cv=none; d=google.com; s=arc-20160816; b=coT9gOXzjmGrMAR1m8F9HXt+dPN0lbratOJWwxwNM4MmdHBSYwqxWqLasJTQOCMLUF JMmmZ98aYe6ZBkCZdGIhStkaiuJq+Wml3tU6k6AgG8z+brBsKy7wlC77KS+0SW7rvjaY YJBdCyj5271Aiit70c50Q1D2Qru4YJuX+dLYaTtSu/XaE3p/7VYUYc6z+nDHl18i7QAG e1GWfVJJEqvDBDln3VtA4qBw9f3U2OHtjLWB6/vr2wBOp1QLYXW64bv8lw6T12vQLF4k WyJosmQtHSOpbKyPa/ZrMwKD5xAN9RS9amLOfsgQ8Z8KLswzxc44HVoSqWTiMWNPHHlU 38nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Bph7aQWiIblfg6yjyGHvzwupxNGD+j58Acq61h0ET4g=; b=I8pyHtaQ/Mm1rVq3HtI9SNafSTIXA8PmqlJ1Ks4CI9uw1scFwW4dsRAzajLTHu0yQf Kr9hRw8QiIh3xvMjcDUz+UbIvqT2qRtmFXRi0cdtMU5Ieb5U7dfheTsE4F2Px7sh+eZz qn5lYJlDvwc6Hsdckur0uidByYYmc8cMG32BKjHWoLt+7phqUQKInaJvzQM9cT5CoTgd H5EMANsirASgsaqYD2v7qFldLIikkGQcnsWLKURIQEiaJYWoARSupxSamunqx9GrWgX4 mnZgYJu7oinlnZvV17k4mbVp3IwIHMj2rcO4gc+uXGL/FXQ1YnJshn3kYswc9qupX8SM SXBA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m37-v6si3546543pla.346.2018.04.10.15.49.17; Tue, 10 Apr 2018 15:49:54 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932574AbeDJWjS (ORCPT + 99 others); Tue, 10 Apr 2018 18:39:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45144 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932556AbeDJWjO (ORCPT ); Tue, 10 Apr 2018 18:39:14 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 659CAD7E; Tue, 10 Apr 2018 22:39:13 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Or Gerlitz , Aviv Heller , Saeed Mahameed Subject: [PATCH 4.14 123/138] net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path Date: Wed, 11 Apr 2018 00:25:13 +0200 Message-Id: <20180410212916.470603428@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Or Gerlitz [ Upstream commit 423c9db29943cfc43e3a408192e9efa4178af6a1 ] Currently we use the global ipv6_stub var to access the ipv6 global nd table. This practice gets us to troubles when the stub is only partially set e.g when ipv6 is loaded under the disabled policy. In this case, as of commit 343d60aada5a ("ipv6: change ipv6_stub_impl.ipv6_dst_lookup to take net argument") the stub is not null, but stub->nd_tbl is and we crash. As we can access the ipv6 nd_tbl directly, the fix is just to avoid the reference through the stub. There is one place in the code where we issue ipv6 route lookup and keep doing it through the stub, but that mentioned commit makes sure we get -EAFNOSUPPORT from the stack. Fixes: 232c001398ae ("net/mlx5e: Add support to neighbour update flow") Signed-off-by: Or Gerlitz Reviewed-by: Aviv Heller Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 6 +++--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -230,7 +230,7 @@ void mlx5e_remove_sqs_fwd_rules(struct m static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv) { #if IS_ENABLED(CONFIG_IPV6) - unsigned long ipv6_interval = NEIGH_VAR(&ipv6_stub->nd_tbl->parms, + unsigned long ipv6_interval = NEIGH_VAR(&nd_tbl.parms, DELAY_PROBE_TIME); #else unsigned long ipv6_interval = ~0UL; @@ -366,7 +366,7 @@ static int mlx5e_rep_netevent_event(stru case NETEVENT_NEIGH_UPDATE: n = ptr; #if IS_ENABLED(CONFIG_IPV6) - if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl) + if (n->tbl != &nd_tbl && n->tbl != &arp_tbl) #else if (n->tbl != &arp_tbl) #endif @@ -414,7 +414,7 @@ static int mlx5e_rep_netevent_event(stru * done per device delay prob time parameter. */ #if IS_ENABLED(CONFIG_IPV6) - if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl)) + if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl)) #else if (!p->dev || p->tbl != &arp_tbl) #endif --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -484,7 +484,7 @@ void mlx5e_tc_update_neigh_used_value(st tbl = &arp_tbl; #if IS_ENABLED(CONFIG_IPV6) else if (m_neigh->family == AF_INET6) - tbl = ipv6_stub->nd_tbl; + tbl = &nd_tbl; #endif else return;