diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-05-16 03:34:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-16 03:34:04 -0400 |
commit | 35790c0421121364883a167bab8a2e37e1f67f78 (patch) | |
tree | a3e032a9ba6bb77337176bef407d7408d6a10a4d /include/net | |
parent | d77f873fdd21912803836da78f627d2efd267082 (diff) |
tcp: fix MD5 (RFC2385) support
TCP MD5 support uses percpu data for temporary storage. It currently
disables preemption so that same storage cannot be reclaimed by another
thread on same cpu.
We also have to make sure a softirq handler wont try to use also same
context. Various bug reports demonstrated corruptions.
Fix is to disable preemption and BH.
Reported-by: Bhaskar Dutta <bhaskie@gmail.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/tcp.h | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 75be5a28815d..aa04b9a5093b 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1197,30 +1197,15 @@ extern int tcp_v4_md5_do_del(struct sock *sk, | |||
1197 | extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); | 1197 | extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); |
1198 | extern void tcp_free_md5sig_pool(void); | 1198 | extern void tcp_free_md5sig_pool(void); |
1199 | 1199 | ||
1200 | extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); | 1200 | extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); |
1201 | extern void __tcp_put_md5sig_pool(void); | 1201 | extern void tcp_put_md5sig_pool(void); |
1202 | |||
1202 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); | 1203 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); |
1203 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, | 1204 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, |
1204 | unsigned header_len); | 1205 | unsigned header_len); |
1205 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, | 1206 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, |
1206 | struct tcp_md5sig_key *key); | 1207 | struct tcp_md5sig_key *key); |
1207 | 1208 | ||
1208 | static inline | ||
1209 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) | ||
1210 | { | ||
1211 | int cpu = get_cpu(); | ||
1212 | struct tcp_md5sig_pool *ret = __tcp_get_md5sig_pool(cpu); | ||
1213 | if (!ret) | ||
1214 | put_cpu(); | ||
1215 | return ret; | ||
1216 | } | ||
1217 | |||
1218 | static inline void tcp_put_md5sig_pool(void) | ||
1219 | { | ||
1220 | __tcp_put_md5sig_pool(); | ||
1221 | put_cpu(); | ||
1222 | } | ||
1223 | |||
1224 | /* write queue abstraction */ | 1209 | /* write queue abstraction */ |
1225 | static inline void tcp_write_queue_purge(struct sock *sk) | 1210 | static inline void tcp_write_queue_purge(struct sock *sk) |
1226 | { | 1211 | { |