Skip to content

Commit

Permalink
batman-adv: bat_socket_read missing checks
Browse files Browse the repository at this point in the history
Writing a icmp_packet_rr and then reading icmp_packet can lead to kernel
memory corruption, if __user *buf is just below TASK_SIZE.

Signed-off-by: Paul Kot <pawlkt@gmail.com>
[sven@narfation.org: made it checkpatch clean]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
  • Loading branch information
Paul Kot authored and Marek Lindner committed Dec 12, 2011
1 parent 69497c1 commit c00b685
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/batman-adv/icmp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf,

spin_unlock_bh(&socket_client->lock);

error = __copy_to_user(buf, &socket_packet->icmp_packet,
socket_packet->icmp_len);
error = copy_to_user(buf, &socket_packet->icmp_packet,
socket_packet->icmp_len);

packet_len = socket_packet->icmp_len;
kfree(socket_packet);
Expand Down

0 comments on commit c00b685

Please sign in to comment.