netfilter: xt_CT: Fix one possible memleak of timeout
Subsystems (2)
PATCH 1/1 netfilter: xt_CT: Fix one possible memleak of timeout
From: Gao Feng <[email protected]>
When nf_ct_timeout_ext_add failed in xt_ct_set_timeout, it should free the timeout refcnt.
Now goto the err_put_timeout error handler instead of going ahead.
--- net/netfilter/xt_CT.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_CT.c +1 -1
@@ -168,7 +168,7 @@ static void __xt_ct_tg_timeout_put(struct ctnl_timeout *timeout) } timeout_ext =nf_ct_timeout_ext_add (ct, timeout,GFP_ATOMIC );if (timeout_ext ==NULL ) - ret = -ENOMEM ; + goto err_put_timeout;rcu_read_unlock ();return ret;
Signature · 1 line
1.9.1
Hi All,
Quoted 6 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, April 6, 2017 7:05 PM
To: [email protected]; [email protected]
Cc: Gao Feng <[email protected]>
Subject: [PATCH nf 1/1] netfilter:xt_CT: Fix one possible memleak of
timeout
Quoted 26 lines
From: Gao Feng <[email protected]>
When
nf_ct_timeout_ext_addfailed inxt_ct_set_timeout, it should free the timeout refcnt.Now goto the
err_put_timeouterror handler instead of going ahead.Signed-off-by Gao Feng <[email protected]>--- net/netfilter/xt_CT.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/netfilter/xt_CT.c index renamed from net/netfilter/xt_CT.c +0
-0b008db0..3cd812c 100644
net/netfilter/xt_CT.c +1
-1@@ -168,7 +168,7 @@ static void __xt_ct_tg_timeout_put(struct ctnl_timeout *timeout) } timeout_ext =nf_ct_timeout_ext_add (ct, timeout,GFP_ATOMIC );if (timeout_ext ==NULL ) - ret = -ENOMEM ; + goto err_put_timeout;rcu_read_unlock ();
Quoted 4 lines
return ret;
--
1.9.1
Sorry, please ignore this patch.
I have sent the v2 patch which keep the -ENOMEM assignment.
Regards
Feng