All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Patrick McHardy <kaber@trash.net>
Cc: Netfilter Development Mailinglist
	<netfilter-devel@lists.netfilter.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [NETFILTER 2.4]: Fix deadlock on NAT helper unload
Date: Sat, 7 Oct 2006 11:50:11 +0200	[thread overview]
Message-ID: <20061007095011.GA2557@1wt.eu> (raw)
In-Reply-To: <4509C252.6010504@trash.net>

Hi Patrick,

I missed this patch, and it seems David did not notice it either.
David, do you have any objection against it ? Otherwise I will
merge it.

Thanks,
Willy

On Thu, Sep 14, 2006 at 10:57:54PM +0200, Patrick McHardy wrote:
> [NETFILTER]: Fix deadlock on NAT helper unload
> When a NAT helper is unlocked conntrack/NAT may deadlock because of
> the following lock sequence:
> 
> .. ip_nat_helper_unregister
> -> ip_ct_selective_cleanup
> -> get_next_corpse		(ip_conntrack_lock)
> -> kill_helper			(ip_nat_lock)
> 
> .. ip_nat_fn			(ip_nat_lock)
> -> ip_nat_setup_info
> -> ip_conntrack_alter_reply	(ip_conntrack_lock)
> 
> Taking ip_nat_lock in kill_helper() is unnecessary since the helper assigned
> to a connection is immutable and new connections can't have the helper that
> is beeing unloaded assigned since it is already removed from the global list.
> 
> Reported by <doublefacer007@gmail.com>.
> 
> Signed-off-by: Patrick McHardy <kaber@trash.net>
> 
> --- a/net/ipv4/netfilter/ip_nat_helper.c	2006-09-03 16:41:53.000000000 +0200
> +++ b/net/ipv4/netfilter/ip_nat_helper.c	2006-09-03 16:42:04.000000000 +0200
> @@ -522,13 +522,7 @@
>  static int
>  kill_helper(const struct ip_conntrack *i, void *helper)
>  {
> -	int ret;
> -
> -	READ_LOCK(&ip_nat_lock);
> -	ret = (i->nat.info.helper == helper);
> -	READ_UNLOCK(&ip_nat_lock);
> -
> -	return ret;
> +	return (i->nat.info.helper == helper);
>  }
>  
>  void ip_nat_helper_unregister(struct ip_nat_helper *me)

  reply	other threads:[~2006-10-07  9:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14 20:57 [NETFILTER 2.4]: Fix deadlock on NAT helper unload Patrick McHardy
2006-10-07  9:50 ` Willy Tarreau [this message]
2006-10-08  4:44   ` David Miller

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=20061007095011.GA2557@1wt.eu \
    --to=w@1wt.eu \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.