netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nf_conntrack_gre: more locking around keymap list
@ 2008-08-20 20:54 adobriyan
  2008-08-21 11:32 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: adobriyan @ 2008-08-20 20:54 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel, netdev

gre_keymap_list should be protected in all places.
(unless I'm misreading something)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 net/netfilter/nf_conntrack_proto_gre.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/net/netfilter/nf_conntrack_proto_gre.c
+++ b/net/netfilter/nf_conntrack_proto_gre.c
@@ -97,10 +97,14 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
 	kmp = &help->help.ct_pptp_info.keymap[dir];
 	if (*kmp) {
 		/* check whether it's a retransmission */
+		read_lock_bh(&nf_ct_gre_lock);
 		list_for_each_entry(km, &gre_keymap_list, list) {
-			if (gre_key_cmpfn(km, t) && km == *kmp)
+			if (gre_key_cmpfn(km, t) && km == *kmp) {
+				read_unlock_bh(&nf_ct_gre_lock);
 				return 0;
+			}
 		}
+		read_unlock_bh(&nf_ct_gre_lock);
 		pr_debug("trying to override keymap_%s for ct %p\n",
 			 dir == IP_CT_DIR_REPLY ? "reply" : "orig", ct);
 		return -EEXIST;


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

* Re: [PATCH] nf_conntrack_gre: more locking around keymap list
  2008-08-20 20:54 [PATCH] nf_conntrack_gre: more locking around keymap list adobriyan
@ 2008-08-21 11:32 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2008-08-21 11:32 UTC (permalink / raw)
  To: adobriyan; +Cc: netfilter-devel, netdev

adobriyan@gmail.com wrote:
> gre_keymap_list should be protected in all places.
> (unless I'm misreading something)

Agreed, I don't see a reason why it wouldn't need the lock.

Applied, thanks. I'll also push this one to -stable.

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

end of thread, other threads:[~2008-08-21 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-20 20:54 [PATCH] nf_conntrack_gre: more locking around keymap list adobriyan
2008-08-21 11:32 ` Patrick McHardy

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).