HomeFreeBSD

mlx4core: Use-after-free causes a resource leak in flow-steering detach

Description

mlx4core: 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.

Linux commit:
3b01fe7f91c8e4f9afc4fae3c5af72c14958d2d8

PR: 264469
Sponsored by: NVIDIA Networking

(cherry picked from commit dd2a8c8f72d369440c36f10512324d42ecedb5c7)

Details

Provenance
hselaskyAuthored on Jun 7 2022, 2:27 PM
Parents
rG43bcc15a4270: ktls: Refer send tag pointer once.
Branches
Unknown
Tags
Unknown