netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Leblond <eric@regit.org>
To: netfilter-devel@vger.kernel.org
Cc: Gomathivinayagam Muthuvinayagam <sankarmail@gmail.com>,
	Eric Leblond <eric@regit.org>
Subject: [PATCH] Fix crash when the same NFCT is used by two stacks.
Date: Thu, 19 Jul 2012 08:56:04 +0200	[thread overview]
Message-ID: <1342680964-1250-2-git-send-email-eric@regit.org> (raw)
In-Reply-To: <1342680964-1250-1-git-send-email-eric@regit.org>

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(-)

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;
 
-- 
1.7.10.4


  reply	other threads:[~2012-07-19  6:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 15:21 Ulogd crashes - NFCT polling mode + NACCT Gomathivinayagam Muthuvinayagam
2012-07-18 18:52 ` Eric Leblond
2012-07-18 18:56   ` Gomathivinayagam Muthuvinayagam
2012-07-19  6:56     ` [PATCH 0/1] Fix NFCT crash Eric Leblond
2012-07-19  6:56       ` Eric Leblond [this message]
2012-07-20  8:09         ` [PATCH] Fix crash when the same NFCT is used by two stacks Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342680964-1250-2-git-send-email-eric@regit.org \
    --to=eric@regit.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=sankarmail@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).