patch-2.4.21 linux-2.4.21/drivers/char/sx.c

Next file: linux-2.4.21/drivers/char/tipar.c
Previous file: linux-2.4.21/drivers/char/sonypi.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.20/drivers/char/sx.c linux-2.4.21/drivers/char/sx.c
@@ -1734,8 +1734,10 @@
 				if (copy_from_user(tmp, (char *)data + i, 
 						   (i + SX_CHUNK_SIZE >
 						    nbytes) ? nbytes - i :
-						   	      SX_CHUNK_SIZE))
+						   	      SX_CHUNK_SIZE)) {
+					kfree (tmp);
 					return -EFAULT;
+				}
 				memcpy_toio    ((char *) (board->base2 + offset + i), tmp, 
 				                (i+SX_CHUNK_SIZE>nbytes)?nbytes-i:SX_CHUNK_SIZE);
 			}

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