netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] net/mlx5: Fix uininitialized pointer read on pointer attr
@ 2020-10-06 18:12 Colin King
  2020-10-06 23:20 ` Saeed Mahameed
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-10-06 18:12 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, David S . Miller,
	Jakub Kicinski, Gustavo A . R . Silva, netdev, linux-rdma
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently the error exit path err_free kfree's attr. In the case where
flow and parse_attr failed to be allocated this return path will free
the uninitialized pointer attr, which is not correct.  In the other
case where attr fails to allocate attr does not need to be freed. So
in both error exits via err_free attr should not be freed, so remove
it.

Addresses-Coverity: ("Uninitialized pointer read")
Fixes: ff7ea04ad579 ("net/mlx5e: Fix potential null pointer dereference")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index a0c356987e1a..e3a968e9e2a0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4569,7 +4569,6 @@ mlx5e_alloc_flow(struct mlx5e_priv *priv, int attr_size,
 err_free:
 	kfree(flow);
 	kvfree(parse_attr);
-	kfree(attr);
 	return err;
 }
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] net/mlx5: Fix uininitialized pointer read on pointer attr
  2020-10-06 18:12 [PATCH][next] net/mlx5: Fix uininitialized pointer read on pointer attr Colin King
@ 2020-10-06 23:20 ` Saeed Mahameed
  0 siblings, 0 replies; 2+ messages in thread
From: Saeed Mahameed @ 2020-10-06 23:20 UTC (permalink / raw)
  To: Colin King, Leon Romanovsky, David S . Miller, Jakub Kicinski,
	Gustavo A . R . Silva, netdev, linux-rdma
  Cc: kernel-janitors, linux-kernel

On Tue, 2020-10-06 at 19:12 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently the error exit path err_free kfree's attr. In the case
> where
> flow and parse_attr failed to be allocated this return path will free
> the uninitialized pointer attr, which is not correct.  In the other
> case where attr fails to allocate attr does not need to be freed. So
> in both error exits via err_free attr should not be freed, so remove
> it.
> 
> Addresses-Coverity: ("Uninitialized pointer read")
> Fixes: ff7ea04ad579 ("net/mlx5e: Fix potential null pointer
> dereference")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index a0c356987e1a..e3a968e9e2a0 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> @@ -4569,7 +4569,6 @@ mlx5e_alloc_flow(struct mlx5e_priv *priv, int
> attr_size,
>  err_free:
>  	kfree(flow);
>  	kvfree(parse_attr);
> -	kfree(attr);
>  	return err;
>  }
>  

Applied to net-next-mlx5,

Thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-06 23:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 18:12 [PATCH][next] net/mlx5: Fix uininitialized pointer read on pointer attr Colin King
2020-10-06 23:20 ` Saeed Mahameed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).