Skip to content

Commit

Permalink
batman-adv: Directly check read of icmp packet in copy_from_user
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marek Lindner <[email protected]>
  • Loading branch information
ecsv authored and Marek Lindner committed Dec 12, 2011
1 parent c00b685 commit d18eb45
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions net/batman-adv/icmp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
skb_reserve(skb, sizeof(struct ethhdr));
icmp_packet = (struct icmp_packet_rr *)skb_put(skb, packet_len);

if (!access_ok(VERIFY_READ, buff, packet_len)) {
len = -EFAULT;
goto free_skb;
}

if (__copy_from_user(icmp_packet, buff, packet_len)) {
if (copy_from_user(icmp_packet, buff, packet_len)) {
len = -EFAULT;
goto free_skb;
}
Expand Down

0 comments on commit d18eb45

Please sign in to comment.