From patchwork Thu Jul 19 06:56:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Leblond X-Patchwork-Id: 171894 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0C7E22C009D for ; Thu, 19 Jul 2012 16:57:09 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751431Ab2GSG5H (ORCPT ); Thu, 19 Jul 2012 02:57:07 -0400 Received: from ks28632.kimsufi.com ([91.121.96.152]:39812 "EHLO ks28632.kimsufi.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917Ab2GSG5D (ORCPT ); Thu, 19 Jul 2012 02:57:03 -0400 Received: from ip-92-50-100-48.unitymediagroup.de ([92.50.100.48] helo=tiger.regit.org) by ks28632.kimsufi.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1SrkfV-0002xv-RR; Thu, 19 Jul 2012 08:57:01 +0200 From: Eric Leblond To: netfilter-devel@vger.kernel.org Cc: Gomathivinayagam Muthuvinayagam , Eric Leblond Subject: [PATCH] Fix crash when the same NFCT is used by two stacks. Date: Thu, 19 Jul 2012 08:56:04 +0200 Message-Id: <1342680964-1250-2-git-send-email-eric@regit.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342680964-1250-1-git-send-email-eric@regit.org> References: <1342680964-1250-1-git-send-email-eric@regit.org> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.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 Reported-by: Gomathivinayagam Muthuvinayagam --- 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;