summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2017-05-18 18:34:41 +0300
committerDavid S. Miller <davem@davemloft.net>2017-05-18 22:18:31 +0300
commit27902f08065ba61514c331b7d6e85635c1655d82 (patch)
tree8d332f01f8326329c31418ee6ac56043c68d7601 /drivers/net
parent74ed053d1c43f1476da82670f27536ddfcb75fdd (diff)
downloadlinux-27902f08065ba61514c331b7d6e85635c1655d82.tar.xz
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: 232c001398ae ("net/mlx5e: Add support to neighbour update flow") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 11c27e4fadf6..a72ecbc27f85 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1404,8 +1404,8 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
if (!(nud_state & NUD_VALID)) {
neigh_event_send(n, NULL);
- neigh_release(n);
- return -EAGAIN;
+ err = -EAGAIN;
+ goto out;
}
err = mlx5_encap_alloc(priv->mdev, e->tunnel_type,
@@ -1510,8 +1510,8 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
if (!(nud_state & NUD_VALID)) {
neigh_event_send(n, NULL);
- neigh_release(n);
- return -EAGAIN;
+ err = -EAGAIN;
+ goto out;
}
err = mlx5_encap_alloc(priv->mdev, e->tunnel_type,