]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx4_core: Use-after-free causes a resource leak in flow-steering detach
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Thu, 29 Dec 2016 16:37:09 +0000 (18:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Dec 2016 19:17:40 +0000 (14:17 -0500)
commitd166469f6d9da67195adce53b74cbafaa6e6e7e1
tree307ef0cf010790193b9cef2dd467ffe58e353c95
parent1bd19c8521aa2424777891d1d224d797daedcb22
net/mlx4_core: Use-after-free causes a resource leak in flow-steering detach

mlx4_QP_FLOW_STEERING_DETACH_wrapper first removes the steering
rule (which results in freeing the rule structure), and then
references a field in this struct (the qp number) when releasing the
busy-status on the rule's qp.

Since this memory was freed, it could reallocated and changed.
Therefore, the qp number in the struct may be incorrect,
so that we are releasing the incorrect qp. This leaves the rule's qp
in the busy state (and could possibly release an incorrect qp as well).

Fix this by saving the qp number in a local variable, for use after
removing the steering rule.

Fixes: 0ad77581a61b ("net/mlx4_core: Disallow releasing VF QPs which have steering rules")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c