On 3/10/23 20:07, Ivan Malov wrote:
Once allocated, a switch port list entry always stays there, even after unplugging the ethdev that created it. Currently, the entry's ethdev ID is not cleared on unplug. Referencing the ethdev ID of a detached representor from a flow rule is going to succeed, which is a bug. Also, if the user unplugs endpoint "A" representor and plugs one for "B" instead, the latter will pick the same ethdev ID as the gone representor, but it will have a new port list entry added for it. If the user tries to reference the ethdev ID from a flow rule, the code will fetch the wrong entry ("A" rather than "B") since it sits closer to the list head. That is a serious bug, too.Make the driver invalidate ethdev ID field on ethdev unplug. Fixes: 1fb65e4dae8a ("net/sfc: support flow action port ID in transfer rules") Fixes: a62ec90522a6 ("net/sfc: add port representors infrastructure") Cc: [email protected] Signed-off-by: Ivan Malov <[email protected]> Reviewed-by: Andy Moreton <[email protected]>
Acked-by: Andrew Rybchenko <[email protected]>

