net: mlx5: Add a missing check on idr_find, free buf
authorAditya Pakki <pakki001@umn.edu>
Tue, 19 Mar 2019 21:42:40 +0000 (16:42 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2019 06:38:44 +0000 (08:38 +0200)
commiteab86503fec0e8a5767fa574ed73b3212bf90b1b
treed454b0b6c8bf7a5535cfb0e083277938e1c17c2a
parentb787544dc5e707fec86161b881391eb9342806e6
net: mlx5: Add a missing check on idr_find, free buf

[ Upstream commit 8e949363f017e2011464812a714fb29710fb95b4 ]

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")
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c