The following commit has been merged in the master branch:
commit 8d143abdeff5ddfdb2b5d6bffae8c1fdbbef4de8
Merge: 24d65d307541b7d9bcbb09e58b9209bb20b2c721 d22e13c6c380261cf0b13d34e6412a1e393b5197
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Mon Dec 12 18:49:28 2011 +0800
Merge branch 'next'
diff --combined icmp_socket.c
index 5bc8649,d9c1e7b..5d69e10
--- a/icmp_socket.c
+++ b/icmp_socket.c
@@@ -136,10 -136,9 +136,9 @@@ static ssize_t bat_socket_read(struct f
spin_unlock_bh(&socket_client->lock);
- error = __copy_to_user(buf, &socket_packet->icmp_packet,
- socket_packet->icmp_len);
+ packet_len = min(count, socket_packet->icmp_len);
+ error = copy_to_user(buf, &socket_packet->icmp_packet, packet_len);
- packet_len = socket_packet->icmp_len;
kfree(socket_packet);
if (error)
@@@ -187,17 -186,12 +186,12 @@@ static ssize_t bat_socket_write(struct
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;
}
- if (icmp_packet->packet_type != BAT_ICMP) {
+ if (icmp_packet->header.packet_type != BAT_ICMP) {
bat_dbg(DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: "
"got bogus packet type (expected: BAT_ICMP)\n");
@@@ -215,9 -209,9 +209,9 @@@
icmp_packet->uid = socket_client->index;
- if (icmp_packet->version != COMPAT_VERSION) {
+ if (icmp_packet->header.version != COMPAT_VERSION) {
icmp_packet->msg_type = PARAMETER_PROBLEM;
- icmp_packet->version = COMPAT_VERSION;
+ icmp_packet->header.version = COMPAT_VERSION;
bat_socket_add_packet(socket_client, icmp_packet, packet_len);
goto free_skb;
}
--
batman-adv