net/mlx5: FPGA, tls, idr remove on flow delete
authorSaeed Mahameed <saeedm@mellanox.com>
Tue, 19 Mar 2019 08:05:41 +0000 (01:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 27 Apr 2019 07:36:32 +0000 (09:36 +0200)
commit1d2499b0860024c7cd973a8dee375105ffd34156
treeff6159c545c7f3f2dac396c95435ffe45016073c
parent785833b9eee027c0d31dfe96225e243f13110939
net/mlx5: FPGA, tls, idr remove on flow delete

[ Upstream commit df3a8344d404a810b4aadbf19b08c8232fbaa715 ]

Flow is kfreed on mlx5_fpga_tls_del_flow but kept in the idr data
structure, this is risky and can cause use-after-free, since the
idr_remove is delayed until tls_send_teardown_cmd completion.

Instead of delaying idr_remove, in this patch we do it on
mlx5_fpga_tls_del_flow, before actually kfree(flow).

Added synchronize_rcu before kfree(flow)

Fixes: ab412e1dd7db ("net/mlx5: Accel, add TLS rx offload routines")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c