Patch "net: sched: act_ct: fix possible refcount leak in tcf_ct_init()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: sched: act_ct: fix possible refcount leak in tcf_ct_init()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-sched-act_ct-fix-possible-refcount-leak-in-tcf_c.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 23d46b1d05593bc0626f3cc30347bfd3fb296b4e
Author: Hangyu Hua <hbh25y@xxxxxxxxx>
Date:   Fri Sep 23 10:00:46 2022 +0800

    net: sched: act_ct: fix possible refcount leak in tcf_ct_init()
    
    [ Upstream commit 6e23ec0ba92d426c77a73a9ccab16346e5e0ef49 ]
    
    nf_ct_put need to be called to put the refcount got by tcf_ct_fill_params
    to avoid possible refcount leak when tcf_ct_flow_table_get fails.
    
    Fixes: c34b961a2492 ("net/sched: act_ct: Create nf flow table per zone")
    Signed-off-by: Hangyu Hua <hbh25y@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220923020046.8021-1-hbh25y@xxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index f4fd584fba08..d85fdefe5730 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -1306,7 +1306,7 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
 
 	err = tcf_ct_flow_table_get(params);
 	if (err)
-		goto cleanup;
+		goto cleanup_params;
 
 	spin_lock_bh(&c->tcf_lock);
 	goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
@@ -1321,6 +1321,9 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
 
 	return res;
 
+cleanup_params:
+	if (params->tmpl)
+		nf_ct_put(params->tmpl);
 cleanup:
 	if (goto_ch)
 		tcf_chain_put_by_act(goto_ch);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux