Skip to contentSkip to conversation

nf_conntrack_h323: Fix locking in process_urq

PATCH Sebastian Pöhn 2 participants 3 messages Jan 15, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

nf_ct_remove_expectations has to be called under nf_conntrack_expect_lock

---

net/netfilter/nf_conntrack_h323_main.c +0 -0
index 9511af0..d477375 100644
@@ -1518,7 +1518,9 @@ static int process_urq(struct sk_buff *skb, struct nf_conn *ct,

        }

        /* Clear old expect */
+       spin_lock_bh(&nf_conntrack_expect_lock); nf_ct_remove_expectations(ct);
+       spin_unlock_bh(&nf_conntrack_expect_lock); info->sig_port[dir] = 0; info->sig_port[!dir] = 0;

maintainer
#1 lore raw

Sebastian Pöhn <[email protected]> wrote:

[ CC netfilter-devel ]

Quoted 1 line

nf_ct_remove_expectations has to be called under nf_conntrack_expect_lock

But nf_ct_remove_expectations grabs that lock?

Added in:

commit ca7433df3a672efc88e08222cfa4b3aa965ca324
Author: Jesper Dangaard Brouer <[email protected]>
netfilter: conntrack: seperate expect locking from nf_conntrack_lock

Quoted 10 lines
net/netfilter/nf_conntrack_h323_main.c +0 -0
index 9511af0..d477375 100644
@@ -1518,7 +1518,9 @@ static int process_urq(struct sk_buff *skb, struct nf_conn *ct,
         }


        /* Clear old expect */
+       spin_lock_bh(&nf_conntrack_expect_lock);
        nf_ct_remove_expectations(ct);

... so I'd expect deadlock.

#2 lore raw

You are right. The problem is fixed since 3.15 with the expect_lock refactoring. We found this in 3.12. Probably this is something for stable releases 3.14 and earlier.

Am 15.01.2016 11:42 nachm. schrieb "Florian Westphal" <[email protected]>:

Quoted 15 lines

Sebastian Pöhn <[email protected]> wrote:

[ CC netfilter-devel ]

Quoted 1 line

nf_ct_remove_expectations has to be called under nf_conntrack_expect_lock

But nf_ct_remove_expectations grabs that lock?

Added in:

commit ca7433df3a672efc88e08222cfa4b3aa965ca324
Author: Jesper Dangaard Brouer <[email protected]>
netfilter: conntrack: seperate expect locking from nf_conntrack_lock

Quoted 13 lines
Quoted 10 lines
net/netfilter/nf_conntrack_h323_main.c +0 -0
index 9511af0..d477375 100644
@@ -1518,7 +1518,9 @@ static int process_urq(struct sk_buff *skb, struct nf_conn *ct,
         }


        /* Clear old expect */
+       spin_lock_bh(&nf_conntrack_expect_lock);
        nf_ct_remove_expectations(ct);

... so I'd expect deadlock.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html