Skip to contentSkip to conversation

netfilter: xt_CT: Fix one possible memleak of timeout

PATCH Superseded [email protected] 1 participant 2 messages Apr 6, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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
index b008db0..3cd812c 100644
@@ -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
author
#1 lore raw

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_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 index renamed from net/netfilter/xt_CT.c +0 -0

b008db0..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