Skip to contentSkip to conversation

net/mlx5e: Fix possible memory leak

PATCH In review Wei Yongjun 3 participants 3 messages May 18, 2017 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5e: Fix possible memory leak

From: Wei Yongjun <[email protected]>

'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")
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +4 -4
index 11c27e4..a72ecbc 100644
@@ -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,
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

'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")
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +2 -2
index 11c27e4..a72ecbc 100644
@@ -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,

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv, · line 1515

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +2 -2
@@ -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;
 	}
Quoted 7 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +0 -1
 	err = mlx5_encap_alloc(priv->mdev, e->tunnel_type,
 
--

To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to a message not in the archive

From: Wei Yongjun <[email protected]>
Date: Thu, 18 May 2017 15:34:41 +0000

Quoted 7 lines

From: Wei Yongjun <[email protected]>

'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")

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html