net/mlx5: Fix use-after-free
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Thu, 22 Mar 2018 18:44:56 +0000 (13:44 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Mar 2018 17:05:58 +0000 (13:05 -0400)
commit594619497f3d6d4b8d8440e6d380e8da9dcc9eeb
tree51d2f3468613ed7f47260ca55400679b9a3522aa
parentf145749dd49d00430e1e735656c757a3552dcd4e
net/mlx5: Fix use-after-free

_rule_ is being freed and then dereferenced by accessing rule->ctx

Fix this by copying the value returned by PTR_ERR(rule->ctx) into a local
variable for its safe use after freeing _rule_

Addresses-Coverity-ID: 1466041 ("Read from pointer after free")
Fixes: 05564d0ae075 ("net/mlx5: Add flow-steering commands for FPGA IPSec implementation")
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c