sfc: fix error unwinds in TC offload
authorEdward Cree <ecree.xilinx@gmail.com>
Tue, 30 May 2023 20:25:27 +0000 (21:25 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 1 Jun 2023 05:30:27 +0000 (22:30 -0700)
commit622ab656344a288acf4fb03d628c3bb5dd241f34
tree4c9edeb478347e44d5719dd5cd3a08a81cc0a69e
parent448a5ce1120c5bdbce1f1ccdabcd31c7d029f328
sfc: fix error unwinds in TC offload

Failure ladders weren't exactly unwinding what the function had done up
 to that point; most seriously, when we encountered an already offloaded
 rule, the failure path tried to remove the new rule from the hashtable,
 which would in fact remove the already-present 'old' rule (since it has
 the same key) from the table, and leak its resources.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202305200745.xmIlkqjH-lkp@intel.com/
Fixes: d902e1a737d4 ("sfc: bare bones TC offload on EF100")
Fixes: 17654d84b47c ("sfc: add offloading of 'foreign' TC (decap) rules")
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230530202527.53115-1-edward.cree@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/sfc/tc.c