aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@mellanox.com>2018-03-13 15:43:43 -0400
committerSaeed Mahameed <saeedm@mellanox.com>2018-03-26 16:58:48 -0400
commit423c9db29943cfc43e3a408192e9efa4178af6a1 (patch)
tree50f6c81a73a24b91a913e72db8145e046afe8cf9
parentaf1607c37d9d85a66fbcf43b7f11bf3d94b9bb69 (diff)
net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path
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 <ogerlitz@mellanox.com> Reviewed-by: Aviv Heller <avivh@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rep.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 9a5a2a7eeab3..500d817d2b0a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -293,7 +293,7 @@ void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv)
293static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv) 293static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv)
294{ 294{
295#if IS_ENABLED(CONFIG_IPV6) 295#if IS_ENABLED(CONFIG_IPV6)
296 unsigned long ipv6_interval = NEIGH_VAR(&ipv6_stub->nd_tbl->parms, 296 unsigned long ipv6_interval = NEIGH_VAR(&nd_tbl.parms,
297 DELAY_PROBE_TIME); 297 DELAY_PROBE_TIME);
298#else 298#else
299 unsigned long ipv6_interval = ~0UL; 299 unsigned long ipv6_interval = ~0UL;
@@ -429,7 +429,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
429 case NETEVENT_NEIGH_UPDATE: 429 case NETEVENT_NEIGH_UPDATE:
430 n = ptr; 430 n = ptr;
431#if IS_ENABLED(CONFIG_IPV6) 431#if IS_ENABLED(CONFIG_IPV6)
432 if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl) 432 if (n->tbl != &nd_tbl && n->tbl != &arp_tbl)
433#else 433#else
434 if (n->tbl != &arp_tbl) 434 if (n->tbl != &arp_tbl)
435#endif 435#endif
@@ -477,7 +477,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
477 * done per device delay prob time parameter. 477 * done per device delay prob time parameter.
478 */ 478 */
479#if IS_ENABLED(CONFIG_IPV6) 479#if IS_ENABLED(CONFIG_IPV6)
480 if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl)) 480 if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl))
481#else 481#else
482 if (!p->dev || p->tbl != &arp_tbl) 482 if (!p->dev || p->tbl != &arp_tbl)
483#endif 483#endif
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index ae11678a31e8..43234cabf444 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -963,7 +963,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
963 tbl = &arp_tbl; 963 tbl = &arp_tbl;
964#if IS_ENABLED(CONFIG_IPV6) 964#if IS_ENABLED(CONFIG_IPV6)
965 else if (m_neigh->family == AF_INET6) 965 else if (m_neigh->family == AF_INET6)
966 tbl = ipv6_stub->nd_tbl; 966 tbl = &nd_tbl;
967#endif 967#endif
968 else 968 else
969 return; 969 return;