Skip to content

Commit 8c1cb87

Browse files
nbd168kuba-moo
authored andcommitted
net: ethernet: mtk_eth_soc: fix flow block refcounting logic
Since we call flow_block_cb_decref on FLOW_BLOCK_UNBIND, we also need to call flow_block_cb_incref for a newly allocated cb. Also fix the accidentally inverted refcount check on unbind. Fixes: 502e84e ("net: ethernet: mtk_eth_soc: add flow offloading support") Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Felix Fietkau <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2960a2d commit 8c1cb87

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/mediatek/mtk_ppe_offload.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
576576
if (IS_ERR(block_cb))
577577
return PTR_ERR(block_cb);
578578

579+
flow_block_cb_incref(block_cb);
579580
flow_block_cb_add(block_cb, f);
580581
list_add_tail(&block_cb->driver_list, &block_cb_list);
581582
return 0;
@@ -584,7 +585,7 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
584585
if (!block_cb)
585586
return -ENOENT;
586587

587-
if (flow_block_cb_decref(block_cb)) {
588+
if (!flow_block_cb_decref(block_cb)) {
588589
flow_block_cb_remove(block_cb, f);
589590
list_del(&block_cb->driver_list);
590591
}

0 commit comments

Comments
 (0)