aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorholger@eitzenberger.org <holger@eitzenberger.org>2013-09-20 16:43:04 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2013-09-27 10:17:47 -0400
commitb21613aeb649293946556410ff10dbb8c639f298 (patch)
tree9debb3a0e3bb9b99bf5b7cdacee5e5630e9eec36
parent8ce440610357b77587433d0df647cea69a6890a8 (diff)
netfilter: nf_ct_sip: extend RCU read lock in set_expected_rtp_rtcp()
Currently set_expected_rtp_rtcp() in the SIP helper uses rcu_dereference() two times to access two different NAT hook functions. However, only the first one is protected by the RCU reader lock, but the 2nd isn't. Fix it by extending the RCU protected area. This is more a cosmetic thing since we rely on all netfilter hooks being rcu_read_lock()ed by nf_hook_slow() in many places anyways, as Patrick McHardy clarified. Signed-off-by: Holger Eitzenberger <holger.eitzenberger@sophos.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/netfilter/nf_conntrack_sip.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index e0c4373b4747..5ed8c441dffd 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -966,7 +966,6 @@ static int set_expected_rtp_rtcp(struct sk_buff *skb, unsigned int protoff,
966#endif 966#endif
967 skip_expect = 1; 967 skip_expect = 1;
968 } while (!skip_expect); 968 } while (!skip_expect);
969 rcu_read_unlock();
970 969
971 base_port = ntohs(tuple.dst.u.udp.port) & ~1; 970 base_port = ntohs(tuple.dst.u.udp.port) & ~1;
972 rtp_port = htons(base_port); 971 rtp_port = htons(base_port);
@@ -980,8 +979,10 @@ static int set_expected_rtp_rtcp(struct sk_buff *skb, unsigned int protoff,
980 goto err1; 979 goto err1;
981 } 980 }
982 981
983 if (skip_expect) 982 if (skip_expect) {
983 rcu_read_unlock();
984 return NF_ACCEPT; 984 return NF_ACCEPT;
985 }
985 986
986 rtp_exp = nf_ct_expect_alloc(ct); 987 rtp_exp = nf_ct_expect_alloc(ct);
987 if (rtp_exp == NULL) 988 if (rtp_exp == NULL)
@@ -1012,6 +1013,7 @@ static int set_expected_rtp_rtcp(struct sk_buff *skb, unsigned int protoff,
1012err2: 1013err2:
1013 nf_ct_expect_put(rtp_exp); 1014 nf_ct_expect_put(rtp_exp);
1014err1: 1015err1:
1016 rcu_read_unlock();
1015 return ret; 1017 return ret;
1016} 1018}
1017 1019