netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Gao feng <gaofeng@cn.fujitsu.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] ulog: add protection when remove ipt_ULOG
Date: Thu, 7 Feb 2013 19:27:08 +0100	[thread overview]
Message-ID: <20130207182708.GA18328@localhost> (raw)
In-Reply-To: <1360029450-6673-1-git-send-email-gaofeng@cn.fujitsu.com>

Hi Gao,

On Tue, Feb 05, 2013 at 09:57:30AM +0800, Gao feng wrote:
> We should add a lock protection when we free the skb,
> because it maybe used by ipt_ulog_packet right now.

Did you hit a reproducible crash?

I think this is very unlikely to happen. The removal of the module
happens in user-context and the entire path to build and deliver the
skb to user-space is protected is under spin_lock_bh, so scheduling
is not possible.

> Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
> ---
>  net/ipv4/netfilter/ipt_ULOG.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
> index b5ef3cb..b390002 100644
> --- a/net/ipv4/netfilter/ipt_ULOG.c
> +++ b/net/ipv4/netfilter/ipt_ULOG.c
> @@ -430,11 +430,12 @@ static void __exit ulog_tg_exit(void)
>  			pr_debug("timer was pending, deleting\n");
>  			del_timer(&ub->timer);
>  		}
> -
> +		spin_lock_bh(&ulog_lock);
>  		if (ub->skb) {
>  			kfree_skb(ub->skb);
>  			ub->skb = NULL;
>  		}
> +		spin_unlock_bh(&ulog_lock);
>  	}
>  }
>  
> -- 
> 1.7.11.7
> 
> --
> 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

  parent reply	other threads:[~2013-02-07 18:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05  1:57 [PATCH] ulog: add protection when remove ipt_ULOG Gao feng
2013-02-05  2:48 ` [PATCH 2/2] netfilter: ipt_ULOG: make spinlock per nlgroup Gao feng
2013-03-15 11:51   ` Pablo Neira Ayuso
2013-03-18  9:11     ` Gao feng
2013-02-07 18:27 ` Pablo Neira Ayuso [this message]
2013-02-18  3:57   ` [PATCH] ulog: add protection when remove ipt_ULOG Gao feng
2013-02-18 16:52     ` Pablo Neira Ayuso
2013-02-19  1:09       ` Gao feng
2013-03-15 11:49 ` 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=20130207182708.GA18328@localhost \
    --to=pablo@netfilter.org \
    --cc=gaofeng@cn.fujitsu.com \
    --cc=netfilter-devel@vger.kernel.org \
    /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).