This is a note to let you know that I've just added the patch titled batman-adv: Only write requested number of byte to user buffer to the 3.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: batman-adv-only-write-requested-number-of-byte-to-user-buffer.patch and it can be found in the queue-3.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From jslaby@xxxxxxx Mon Apr 1 16:36:25 2013 From: Jiri Slaby <jslaby@xxxxxxx> Date: Tue, 19 Mar 2013 12:36:50 +0100 Subject: batman-adv: Only write requested number of byte to user buffer To: gregkh@xxxxxxxxxxxxxxxxxxx Cc: jirislaby@xxxxxxxxx, stable@xxxxxxxxxxxxxxx, Sven Eckelmann <sven@xxxxxxxxxxxxx>, Marek Lindner <lindner_marek@xxxxxxxx>, Jiri Slaby <jslaby@xxxxxxx> Message-ID: <1363693019-14812-5-git-send-email-jslaby@xxxxxxx> From: Sven Eckelmann <sven@xxxxxxxxxxxxx> commit b5a1eeef04cc7859f34dec9b72ea1b28e4aba07c upstream. Don't write more than the requested number of bytes of an batman-adv icmp packet to the userspace buffer. Otherwise unrelated userspace memory might get overridden by the kernel. Signed-off-by: Sven Eckelmann <sven@xxxxxxxxxxxxx> Signed-off-by: Marek Lindner <lindner_marek@xxxxxxxx> Signed-off-by: Jiri Slaby <jslaby@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/batman-adv/icmp_socket.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c @@ -136,10 +136,9 @@ static ssize_t bat_socket_read(struct fi 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) Patches currently in stable-queue which might be from jslaby@xxxxxxx are queue-3.0/kvm-x86-prevent-starting-pit-timers-in-the-absence-of-irqchip-support.patch queue-3.0/kvm-x86-invalid-opcode-oops-on-set_sregs-with-osxsave-bit-set-cve-2012-4461.patch queue-3.0/mm-hotplug-correctly-add-new-zone-to-all-other-nodes-zone-lists.patch queue-3.0/macvtap-zerocopy-validate-vectors-before-building-skb.patch queue-3.0/x25-validate-incoming-call-user-data-lengths.patch queue-3.0/batman-adv-bat_socket_read-missing-checks.patch queue-3.0/kvm-fix-buffer-overflow-in-kvm_set_irq.patch queue-3.0/x25-handle-undersized-fragmented-skbs.patch queue-3.0/nfsv4-include-bitmap-in-nfsv4-get-acl-data.patch queue-3.0/nfs-nfs_getaclargs.acl_len-is-a-size_t.patch queue-3.0/nfsv4-fix-an-oops-in-the-nfsv4-getacl-code.patch queue-3.0/kvm-clean-up-error-handling-during-vcpu-creation.patch queue-3.0/kvm-ensure-all-vcpus-are-consistent-with-in-kernel-irqchip-settings.patch queue-3.0/batman-adv-only-write-requested-number-of-byte-to-user-buffer.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html