diff mbox

Fix crash when the same NFCT is used by two stacks.

Message ID 1342680964-1250-2-git-send-email-eric@regit.org
State Accepted
Headers show

Commit Message

Eric Leblond July 19, 2012, 6:56 a.m. UTC
The polling timer initialisation code was put in the configurator
code. It was then created for all instances. But only first one has
a valid NFCT handle. This was resulting in a crash.
This patch moves the timer initialisation in the constructor which
is called only once on the main NFCT instance.

Signed-off-by: Eric Leblond <eric@regit.org>
Reported-by: Gomathivinayagam Muthuvinayagam <sankarmail@gmail.com>
---
 input/flow/ulogd_inpflow_NFCT.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Pablo Neira Ayuso July 20, 2012, 8:09 a.m. UTC | #1
On Thu, Jul 19, 2012 at 08:56:04AM +0200, Eric Leblond wrote:
> The polling timer initialisation code was put in the configurator
> code. It was then created for all instances. But only first one has
> a valid NFCT handle. This was resulting in a crash.
> This patch moves the timer initialisation in the constructor which
> is called only once on the main NFCT instance.

Applied, thanks Eric!
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/input/flow/ulogd_inpflow_NFCT.c b/input/flow/ulogd_inpflow_NFCT.c
index b45a435..dcba58f 100644
--- a/input/flow/ulogd_inpflow_NFCT.c
+++ b/input/flow/ulogd_inpflow_NFCT.c
@@ -982,11 +982,6 @@  static int configure_nfct(struct ulogd_pluginstance *upi,
 	if (ret < 0)
 		return ret;
 
-	ulogd_init_timer(&cpi->timer, upi, polling_timer_cb);
-	if (pollint_ce(upi->config_kset).u.value != 0)
-		ulogd_add_timer(&cpi->timer,
-				pollint_ce(upi->config_kset).u.value);
-
 	return 0;
 }
 
@@ -1152,6 +1147,11 @@  static int constructor_nfct_polling(struct ulogd_pluginstance *upi)
 	if (cpi->ct == NULL)
 		goto err_ct_cache;
 
+	ulogd_init_timer(&cpi->timer, upi, polling_timer_cb);
+	if (pollint_ce(upi->config_kset).u.value != 0)
+		ulogd_add_timer(&cpi->timer,
+				pollint_ce(upi->config_kset).u.value);
+
 	ulogd_log(ULOGD_NOTICE, "NFCT working in polling mode\n");
 	return 0;