summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorEli Cohen <eli@mellanox.com>2019-06-27 08:34:41 +0300
committerSaeed Mahameed <saeedm@mellanox.com>2019-07-15 13:04:04 -0700
commitd71f895c31952cfd3277f82ebed60fc3f2350b52 (patch)
treefa9b5f66349dfee6fd9707de0a3d7b0a457410d3 /drivers/net/ethernet
parentf384e62a82ba5d85408405fdd6aeff89354deaa9 (diff)
downloadlinux-d71f895c31952cfd3277f82ebed60fc3f2350b52.tar.gz
linux-d71f895c31952cfd3277f82ebed60fc3f2350b52.tar.bz2
linux-d71f895c31952cfd3277f82ebed60fc3f2350b52.zip
net/mlx5e: Verify encapsulation is supported
When mlx5e_attach_encap() calls mlx5e_get_tc_tun() to get the tunnel info data struct, check that returned value is not NULL, as would be in the case of unsupported encapsulation. Fixes: d386939a327d2 ("net/mlx5e: Rearrange tc tunnel code in a modular way") Signed-off-by: Eli Cohen <eli@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 2d6436257f9d..018709a4343f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2647,6 +2647,10 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
family = ip_tunnel_info_af(tun_info);
key.ip_tun_key = &tun_info->key;
key.tc_tunnel = mlx5e_get_tc_tun(mirred_dev);
+ if (!key.tc_tunnel) {
+ NL_SET_ERR_MSG_MOD(extack, "Unsupported tunnel");
+ return -EOPNOTSUPP;
+ }
hash_key = hash_encap_info(&key);