patch-2.4.0-test6 linux/net/ipv4/ip_options.c

Next file: linux/net/ipv4/ip_sockglue.c
Previous file: linux/net/ipv4/ip_gre.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test5/linux/net/ipv4/ip_options.c linux/net/ipv4/ip_options.c
@@ -5,7 +5,7 @@
  *
  *		The options processing module for ip.c
  *
- * Version:	$Id: ip_options.c,v 1.18 1999/06/09 08:29:06 davem Exp $
+ * Version:	$Id: ip_options.c,v 1.20 2000/08/09 09:17:00 davem Exp $
  *
  * Authors:	A.N.Kuznetsov
  *		
@@ -498,8 +498,10 @@
 	memset(opt, 0, sizeof(struct ip_options));
 	if (optlen) {
 		if (user) {
-			if (copy_from_user(opt->__data, data, optlen))
+			if (copy_from_user(opt->__data, data, optlen)) {
+				kfree(opt);
 				return -EFAULT;
+			}
 		} else
 			memcpy(opt->__data, data, optlen);
 	}

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