Re: [PATCH v4] net: mlx5: Add a missing check on idr_find, free buf

From: Saeed Mahameed
Date: Tue Mar 19 2019 - 18:37:59 EST


On Tue, 2019-03-19 at 16:42 -0500, Aditya Pakki wrote:
> idr_find() can return a NULL value to 'flow' which is used without a
> check. The patch adds a check to avoid potential NULL pointer
> dereference.
>
> In case of mlx5_fpga_sbu_conn_sendmsg() failure, free buf allocated
> using kzalloc.
>
> Fixes: ab412e1dd7db ("net/mlx5: Accel, add TLS rx offload routines")
> ---
> v3: Reorder buf allocations and flow check.
> v2: failure to return in case of flow failure.
> v1: Failed to free buf in case of flow failure.
>
> Signed-off-by: Aditya Pakki <pakki001@xxxxxxx>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c | 14 +++++++++++-
> --
> 1 file changed, 11 insertions(+), 3 deletions(-)
>

Applied to net-mlx5, will be sent upstream shortly,

You messed up the Signed-off tag, it also should have been part of the
commit message, but don't worry, i fixed it up and added Yuval's
Reviewed-by.

Thanks Adeitya for handling all of the comments.
Saeed.