Commit 27902f08 authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

net/mlx5e: Fix possible memory leak

'encap_header' is malloced and should be freed before leaving from
the error handling cases, otherwise it will cause memory leak.

Fixes: 232c0013 ("net/mlx5e: Add support to neighbour update flow")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: default avatarYuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 74ed053d
...@@ -1404,8 +1404,8 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv, ...@@ -1404,8 +1404,8 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
if (!(nud_state & NUD_VALID)) { if (!(nud_state & NUD_VALID)) {
neigh_event_send(n, NULL); neigh_event_send(n, NULL);
neigh_release(n); err = -EAGAIN;
return -EAGAIN; goto out;
} }
err = mlx5_encap_alloc(priv->mdev, e->tunnel_type, err = mlx5_encap_alloc(priv->mdev, e->tunnel_type,
...@@ -1510,8 +1510,8 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv, ...@@ -1510,8 +1510,8 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
if (!(nud_state & NUD_VALID)) { if (!(nud_state & NUD_VALID)) {
neigh_event_send(n, NULL); neigh_event_send(n, NULL);
neigh_release(n); err = -EAGAIN;
return -EAGAIN; goto out;
} }
err = mlx5_encap_alloc(priv->mdev, e->tunnel_type, err = mlx5_encap_alloc(priv->mdev, e->tunnel_type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment