diff options
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r-- | net/ipv4/raw.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index ff0f071969e..73d1e4df4bf 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -131,18 +131,20 @@ found: | |||
131 | * 0 - deliver | 131 | * 0 - deliver |
132 | * 1 - block | 132 | * 1 - block |
133 | */ | 133 | */ |
134 | static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb) | 134 | static int icmp_filter(const struct sock *sk, const struct sk_buff *skb) |
135 | { | 135 | { |
136 | int type; | 136 | struct icmphdr _hdr; |
137 | const struct icmphdr *hdr; | ||
137 | 138 | ||
138 | if (!pskb_may_pull(skb, sizeof(struct icmphdr))) | 139 | hdr = skb_header_pointer(skb, skb_transport_offset(skb), |
140 | sizeof(_hdr), &_hdr); | ||
141 | if (!hdr) | ||
139 | return 1; | 142 | return 1; |
140 | 143 | ||
141 | type = icmp_hdr(skb)->type; | 144 | if (hdr->type < 32) { |
142 | if (type < 32) { | ||
143 | __u32 data = raw_sk(sk)->filter.data; | 145 | __u32 data = raw_sk(sk)->filter.data; |
144 | 146 | ||
145 | return ((1 << type) & data) != 0; | 147 | return ((1U << hdr->type) & data) != 0; |
146 | } | 148 | } |
147 | 149 | ||
148 | /* Do not block unknown ICMP types */ | 150 | /* Do not block unknown ICMP types */ |
@@ -992,7 +994,9 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
992 | i, src, srcp, dest, destp, sp->sk_state, | 994 | i, src, srcp, dest, destp, sp->sk_state, |
993 | sk_wmem_alloc_get(sp), | 995 | sk_wmem_alloc_get(sp), |
994 | sk_rmem_alloc_get(sp), | 996 | sk_rmem_alloc_get(sp), |
995 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), | 997 | 0, 0L, 0, |
998 | from_kuid_munged(seq_user_ns(seq), sock_i_uid(sp)), | ||
999 | 0, sock_i_ino(sp), | ||
996 | atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); | 1000 | atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); |
997 | } | 1001 | } |
998 | 1002 | ||