patch-2.4.10 linux/drivers/usb/serial/mct_u232.c

Next file: linux/drivers/usb/serial/omninet.c
Previous file: linux/drivers/usb/serial/keyspan_pda.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/drivers/usb/serial/mct_u232.c linux/drivers/usb/serial/mct_u232.c
@@ -94,7 +94,7 @@
  */
 #undef FIX_WRITE_RETURN_CODE_PROBLEM
 #ifdef FIX_WRITE_RETURN_CODE_PROBLEM
-static int write_blocking = 0; /* disabled by default */
+static int write_blocking; /* disabled by default */
 #endif
 
 /*
@@ -524,7 +524,10 @@
 		usb_serial_debug_data (__FILE__, __FUNCTION__, size, buf);
 		
 		if (from_user) {
-			copy_from_user(port->write_urb->transfer_buffer, buf, size);
+			if (copy_from_user(port->write_urb->transfer_buffer, buf, size)) {
+				up (&port->sem);
+				return -EFAULT;
+			}
 		}
 		else {
 			memcpy (port->write_urb->transfer_buffer, buf, size);
@@ -815,7 +818,7 @@
 {
 	struct usb_serial *serial = port->serial;
 	struct mct_u232_private *priv = (struct mct_u232_private *)port->private;
-	int ret, mask;
+	int mask;
 	
 	dbg (__FUNCTION__ "cmd=0x%x", cmd);
 
@@ -828,7 +831,8 @@
 	case TIOCMSET: /* Turns on and off the lines as specified by the mask */
 	case TIOCMBIS: /* turns on (Sets) the lines as specified by the mask */
 	case TIOCMBIC: /* turns off (Clears) the lines as specified by the mask */
-		if ((ret = get_user(mask, (unsigned long *) arg))) return ret;
+		if (get_user(mask, (unsigned long *) arg))
+			return -EFAULT;
 
 		if ((cmd == TIOCMSET) || (mask & TIOCM_RTS)) {
 			/* RTS needs set */
@@ -892,6 +896,7 @@
 
 MODULE_AUTHOR( DRIVER_AUTHOR );
 MODULE_DESCRIPTION( DRIVER_DESC );
+MODULE_LICENSE("GPL");
 
 #ifdef FIX_WRITE_RETURN_CODE_PROBLEM
 MODULE_PARM(write_blocking, "i");

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)