All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] locking issue in __unexpect_related
@ 2004-04-21 23:05 Pablo Neira
  2004-04-21 23:32 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira @ 2004-04-21 23:05 UTC (permalink / raw)
  To: Netfilter Development Mailinglist, Harald Welte

[-- Attachment #1: Type: text/plain, Size: 345 bytes --]

Hi Harald and list,

In the function __unexpect_related:

         /* delete from global and local lists */
         list_del(&expect->list);
         list_del(&expect->expected_list);

If an entry of the global list of expectation is erased, shouldn't this 
operation be write_lock'ed? If missing something, please let me know.

regards,
Pablo

[-- Attachment #2: unexpect_related-lock.patch --]
[-- Type: text/plain, Size: 485 bytes --]

--- linux-2.6.3-old/net/ipv4/netfilter/ip_conntrack_core.c	2004-04-14 21:32:58.000000000 +0200
+++ linux-2.6.3/net/ipv4/netfilter/ip_conntrack_core.c	2004-04-22 00:55:42.000000000 +0200
@@ -226,7 +226,9 @@
 	IP_NF_ASSERT(!expect->sibling);
 
 	/* delete from global and local lists */
+	WRITE_LOCK(&ip_conntrack_expect_list);
 	list_del(&expect->list);
+	WRITE_UNLOCK(&ip_conntrack_expect_list);
 	list_del(&expect->expected_list);
 
 	/* decrement expect-count of master conntrack */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] locking issue in __unexpect_related
  2004-04-21 23:05 [PATCH] locking issue in __unexpect_related Pablo Neira
@ 2004-04-21 23:32 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2004-04-21 23:32 UTC (permalink / raw)
  To: Pablo Neira; +Cc: Netfilter Development Mailinglist, Harald Welte

Pablo Neira wrote:
> Hi Harald and list,
> 
> In the function __unexpect_related:
> 
>         /* delete from global and local lists */
>         list_del(&expect->list);
>         list_del(&expect->expected_list);
> 
> If an entry of the global list of expectation is erased, shouldn't this 
> operation be write_lock'ed? If missing something, please let me know.

Your patch will deadlock, the function should only be called under
write-locked ip_conntrack_lock, which you can see by the
MUST_BE_WRITE_LOCKED assertion. Check the callers ..

Regards
Patrick


> 
> regards,
> Pablo
> 
> 
> ------------------------------------------------------------------------
> 
> --- linux-2.6.3-old/net/ipv4/netfilter/ip_conntrack_core.c	2004-04-14 21:32:58.000000000 +0200
> +++ linux-2.6.3/net/ipv4/netfilter/ip_conntrack_core.c	2004-04-22 00:55:42.000000000 +0200
> @@ -226,7 +226,9 @@
>  	IP_NF_ASSERT(!expect->sibling);
>  
>  	/* delete from global and local lists */
> +	WRITE_LOCK(&ip_conntrack_expect_list);
>  	list_del(&expect->list);
> +	WRITE_UNLOCK(&ip_conntrack_expect_list);
>  	list_del(&expect->expected_list);
>  
>  	/* decrement expect-count of master conntrack */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-21 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-21 23:05 [PATCH] locking issue in __unexpect_related Pablo Neira
2004-04-21 23:32 ` Patrick McHardy

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.