[PATCH net] net/mlx5: Lag, fix a potential Oops with mlx5_lag_create_definer()

Subsystems: mellanox mlx5 core vpi driver, networking drivers, the rest

STALE1734d

3 messages, 3 authors, 2021-11-10 · open the first message on its own page

[PATCH net] net/mlx5: Lag, fix a potential Oops with mlx5_lag_create_definer()

From: Dan Carpenter <hidden>
Date: 2021-11-10 08:07:35

There is a minus character missing from ERR_PTR(ENOMEM) so if this
allocation fails it will lead to an Oops in the caller.

Fixes: dc48516ec7d3 ("net/mlx5: Lag, add support to create definers for LAG")
Signed-off-by: Dan Carpenter <redacted>
---
 drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
index adc836b3d857..ad63dd45c8fb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
@@ -289,7 +289,7 @@ mlx5_lag_create_definer(struct mlx5_lag *ldev, enum netdev_lag_hash hash,
 
 	lag_definer = kzalloc(sizeof(*lag_definer), GFP_KERNEL);
 	if (!lag_definer)
-		return ERR_PTR(ENOMEM);
+		return ERR_PTR(-ENOMEM);
 
 	match_definer_mask = kvzalloc(MLX5_FLD_SZ_BYTES(match_definer,
 							match_mask),
-- 
2.20.1

Re: [PATCH net] net/mlx5: Lag, fix a potential Oops with mlx5_lag_create_definer()

From: Leon Romanovsky <leon@kernel.org>
Date: 2021-11-10 14:35:13

On Wed, Nov 10, 2021 at 11:07:06AM +0300, Dan Carpenter wrote:
There is a minus character missing from ERR_PTR(ENOMEM) so if this
allocation fails it will lead to an Oops in the caller.

Fixes: dc48516ec7d3 ("net/mlx5: Lag, add support to create definers for LAG")
Signed-off-by: Dan Carpenter <redacted>
---
 drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

Re: [PATCH net] net/mlx5: Lag, fix a potential Oops with mlx5_lag_create_definer()

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-11-10 14:50:15

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller [off-list ref]:

On Wed, 10 Nov 2021 11:07:06 +0300 you wrote:
There is a minus character missing from ERR_PTR(ENOMEM) so if this
allocation fails it will lead to an Oops in the caller.

Fixes: dc48516ec7d3 ("net/mlx5: Lag, add support to create definers for LAG")
Signed-off-by: Dan Carpenter <redacted>
---
 drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
  - [net] net/mlx5: Lag, fix a potential Oops with mlx5_lag_create_definer()
    https://git.kernel.org/netdev/net/c/c7ebe23cee35

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help