This is a note to let you know that I've just added the patch titled

    USB: mos7720: fix DMA to stack

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:
     usb-mos7720-fix-dma-to-stack.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 <[email protected]> know about it.


>From 72ea18a558ed7a63a50bb121ba60d73b5b38ae30 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 27 May 2013 14:44:39 +0200
Subject: USB: mos7720: fix DMA to stack

From: Johan Hovold <[email protected]>

commit 72ea18a558ed7a63a50bb121ba60d73b5b38ae30 upstream.

The read_mos_reg function is called with stack-allocated buffers, which
must not be used for control messages.

Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/usb/serial/mos7720.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -234,11 +234,22 @@ static int read_mos_reg(struct usb_seria
        __u8 requesttype = (__u8)0xc0;
        __u16 index = get_reg_index(reg);
        __u16 value = get_reg_value(reg, serial_portnum);
-       int status = usb_control_msg(usbdev, pipe, request, requesttype, value,
-                                    index, data, 1, MOS_WDR_TIMEOUT);
-       if (status < 0)
+       u8 *buf;
+       int status;
+
+       buf = kmalloc(1, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+
+       status = usb_control_msg(usbdev, pipe, request, requesttype, value,
+                                    index, buf, 1, MOS_WDR_TIMEOUT);
+       if (status == 1)
+               *data = *buf;
+       else if (status < 0)
                dev_err(&usbdev->dev,
                        "mos7720: usb_control_msg() failed: %d", status);
+       kfree(buf);
+
        return status;
 }
 


Patches currently in stable-queue which might be from [email protected] are

queue-3.0/usb-serial-fix-treo-kyocera-interrrupt-in-urb-context.patch
queue-3.0/usb-mos7720-fix-dma-to-stack.patch
queue-3.0/usb-iuu_phoenix-fix-bulk-message-timeout.patch
queue-3.0/usb-whiteheat-fix-broken-port-configuration.patch
queue-3.0/usb-mos7720-fix-hardware-flow-control.patch
queue-3.0/usb-keyspan-fix-bogus-array-index.patch
queue-3.0/usb-ark3116-fix-control-message-timeout.patch
queue-3.0/usb-mos7720-fix-message-timeouts.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to