Commit 328ff99f authored by Rusty Russell's avatar Rusty Russell Committed by Hideaki Yoshifuji

[NETFILTER]: Fix locking in ip_conntrack.

http://bugme.osdl.org/show_bug.cgi?id=1764
We're walking the expect list without the ip_conntrack_expect_tuple_lock.
parent 35f9c7ce
...@@ -50,5 +50,6 @@ static inline int ip_conntrack_confirm(struct sk_buff *skb) ...@@ -50,5 +50,6 @@ static inline int ip_conntrack_confirm(struct sk_buff *skb)
extern struct list_head *ip_conntrack_hash; extern struct list_head *ip_conntrack_hash;
extern struct list_head ip_conntrack_expect_list; extern struct list_head ip_conntrack_expect_list;
DECLARE_RWLOCK_EXTERN(ip_conntrack_lock); DECLARE_RWLOCK_EXTERN(ip_conntrack_lock);
DECLARE_RWLOCK_EXTERN(ip_conntrack_expect_tuple_lock);
#endif /* _IP_CONNTRACK_CORE_H */ #endif /* _IP_CONNTRACK_CORE_H */
...@@ -159,6 +159,7 @@ list_conntracks(char *buffer, char **start, off_t offset, int length) ...@@ -159,6 +159,7 @@ list_conntracks(char *buffer, char **start, off_t offset, int length)
} }
/* Now iterate through expecteds. */ /* Now iterate through expecteds. */
READ_LOCK(&ip_conntrack_expect_tuple_lock);
list_for_each(e, &ip_conntrack_expect_list) { list_for_each(e, &ip_conntrack_expect_list) {
unsigned int last_len; unsigned int last_len;
struct ip_conntrack_expect *expect struct ip_conntrack_expect *expect
...@@ -169,10 +170,12 @@ list_conntracks(char *buffer, char **start, off_t offset, int length) ...@@ -169,10 +170,12 @@ list_conntracks(char *buffer, char **start, off_t offset, int length)
len += print_expect(buffer + len, expect); len += print_expect(buffer + len, expect);
if (len > length) { if (len > length) {
len = last_len; len = last_len;
goto finished; goto finished_expects;
} }
} }
finished_expects:
READ_UNLOCK(&ip_conntrack_expect_tuple_lock);
finished: finished:
READ_UNLOCK(&ip_conntrack_lock); READ_UNLOCK(&ip_conntrack_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment