tcp: Fix MD5 signatures for non-linear skbs
Currently, the MD5 code assumes that the SKBs are linear and, in the case that they aren't, happily goes off and hashes off the end of the SKB and into random memory. Reported by Stephen Hemminger in [1]. Advice thanks to Stephen and Evgeniy Polyakov. Also includes a couple of missed route_caps from Stephen's patch in [2]. [1] http://marc.info/?l=linux-netdev&m=121445989106145&w=2 [2] http://marc.info/?l=linux-netdev&m=121459157816964&w=2 Signed-off-by: Adam Langley <agl@imperialviolet.org> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
845525a642
commit
49a72dfb88
@@ -1112,20 +1112,12 @@ struct tcp_md5sig_pool {
|
||||
#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */
|
||||
|
||||
/* - functions */
|
||||
extern int tcp_calc_md5_hash(char *md5_hash,
|
||||
struct tcp_md5sig_key *key,
|
||||
int bplen,
|
||||
struct tcphdr *th,
|
||||
unsigned int tcplen,
|
||||
struct tcp_md5sig_pool *hp);
|
||||
extern int tcp_v4_md5_hash_skb(char *md5_hash,
|
||||
struct tcp_md5sig_key *key,
|
||||
struct sock *sk,
|
||||
struct request_sock *req,
|
||||
struct sk_buff *skb);
|
||||
|
||||
extern int tcp_v4_calc_md5_hash(char *md5_hash,
|
||||
struct tcp_md5sig_key *key,
|
||||
struct sock *sk,
|
||||
struct dst_entry *dst,
|
||||
struct request_sock *req,
|
||||
struct tcphdr *th,
|
||||
unsigned int tcplen);
|
||||
extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
|
||||
struct sock *addr_sk);
|
||||
|
||||
@@ -1152,6 +1144,11 @@ extern void tcp_free_md5sig_pool(void);
|
||||
|
||||
extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu);
|
||||
extern void __tcp_put_md5sig_pool(void);
|
||||
extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *);
|
||||
extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *,
|
||||
unsigned header_len);
|
||||
extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
|
||||
struct tcp_md5sig_key *key);
|
||||
|
||||
static inline
|
||||
struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
|
||||
@@ -1381,10 +1378,8 @@ struct tcp_sock_af_ops {
|
||||
int (*calc_md5_hash) (char *location,
|
||||
struct tcp_md5sig_key *md5,
|
||||
struct sock *sk,
|
||||
struct dst_entry *dst,
|
||||
struct request_sock *req,
|
||||
struct tcphdr *th,
|
||||
unsigned int len);
|
||||
struct sk_buff *skb);
|
||||
int (*md5_add) (struct sock *sk,
|
||||
struct sock *addr_sk,
|
||||
u8 *newkey,
|
||||
|
||||
Reference in New Issue
Block a user