diff options
author | Sven Eckelmann <sven@narfation.org> | 2011-12-10 09:28:35 -0500 |
---|---|---|
committer | Marek Lindner <lindner_marek@yahoo.de> | 2011-12-12 06:11:06 -0500 |
commit | d18eb45332478f319e5cf996e093228a68864cce (patch) | |
tree | 56aca42703092ea2198ff5ee68456968dab0f70e /net/batman-adv/icmp_socket.c | |
parent | c00b6856fc642b234895cfabd15b289e76726430 (diff) |
batman-adv: Directly check read of icmp packet in copy_from_user
The access_ok read check can be directly done in copy_from_user since a failure
of access_ok is handled the same way as an error in __copy_from_user.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/icmp_socket.c')
-rw-r--r-- | net/batman-adv/icmp_socket.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 88ab26f5f726..3b04fff3ede3 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -187,12 +187,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, | |||
187 | skb_reserve(skb, sizeof(struct ethhdr)); | 187 | skb_reserve(skb, sizeof(struct ethhdr)); |
188 | icmp_packet = (struct icmp_packet_rr *)skb_put(skb, packet_len); | 188 | icmp_packet = (struct icmp_packet_rr *)skb_put(skb, packet_len); |
189 | 189 | ||
190 | if (!access_ok(VERIFY_READ, buff, packet_len)) { | 190 | if (copy_from_user(icmp_packet, buff, packet_len)) { |
191 | len = -EFAULT; | ||
192 | goto free_skb; | ||
193 | } | ||
194 | |||
195 | if (__copy_from_user(icmp_packet, buff, packet_len)) { | ||
196 | len = -EFAULT; | 191 | len = -EFAULT; |
197 | goto free_skb; | 192 | goto free_skb; |
198 | } | 193 | } |