[PATCH OLK-6.6] net/oenetcls: Fix memleak when clean flow table

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICS3XV -------------------------------- When clean dev flow table in oecls_dev_flow_table_cleanup(), the oecls_ftb memory of every dev queue should be freed. Fixes: 4bed6ba0e88f ("net/oenetcls: introduce oenetcls for network optimization") Signed-off-by: Wang Liang <wangliang74@huawei.com> --- net/oenetcls/oenetcls_flow.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/oenetcls/oenetcls_flow.c b/net/oenetcls/oenetcls_flow.c index 87efb5e6a126..eb7fae400e8e 100644 --- a/net/oenetcls/oenetcls_flow.c +++ b/net/oenetcls/oenetcls_flow.c @@ -252,15 +252,16 @@ static void oecls_dev_flow_table_cleanup(struct net_device *netdev, int qid) struct netdev_rx_queue *queue; int i; - spin_lock(&oecls_dev_flow_lock); for (i = 0; i < qid; i++) { queue = netdev->_rx + i; + spin_lock(&oecls_dev_flow_lock); dtb = rcu_dereference_protected(queue->oecls_ftb, lockdep_is_held(&oecls_dev_flow_lock)); rcu_assign_pointer(queue->oecls_ftb, NULL); + spin_unlock(&oecls_dev_flow_lock); + if (dtb) + call_rcu(&dtb->rcu, oecls_dev_flow_table_free); } - spin_unlock(&oecls_dev_flow_lock); - call_rcu(&dtb->rcu, oecls_dev_flow_table_free); } static int oecls_dev_flow_table_release(void) -- 2.34.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/18352 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/P7L... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/18352 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/P7L...
participants (2)
-
patchwork bot
-
Wang Liang