This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / usb / serial / keyspan.c
index 20adf2e..7b4f984 100644 (file)
@@ -342,7 +342,7 @@ static int keyspan_ioctl(struct usb_serial_port *port, struct file *file,
 
        /* Write function is similar for the four protocols used
           with only a minor change for usa90 (usa19hs) required */
-static int keyspan_write(struct usb_serial_port *port, 
+static int keyspan_write(struct usb_serial_port *port, int from_user, 
                         const unsigned char *buf, int count)
 {
        struct keyspan_port_private     *p_priv;
@@ -396,7 +396,12 @@ static int keyspan_write(struct usb_serial_port *port,
                   for now so set to zero */
                ((char *)this_urb->transfer_buffer)[0] = 0;
 
-               memcpy (this_urb->transfer_buffer + dataOffset, buf, todo);
+               if (from_user) {
+                       if (copy_from_user(this_urb->transfer_buffer + dataOffset, buf, todo))
+                               return -EFAULT;
+               } else {
+                       memcpy (this_urb->transfer_buffer + dataOffset, buf, todo);
+               }
                buf += todo;
 
                /* send the data out the bulk port */
@@ -1121,7 +1126,7 @@ static inline void stop_urb(struct urb *urb)
 {
        if (urb && urb->status == -EINPROGRESS) {
                urb->transfer_flags &= ~URB_ASYNC_UNLINK;
-               usb_kill_urb(urb);
+               usb_unlink_urb(urb);
        }
 }