patch-2.1.10 linux/net/ipv4/arp.c

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

diff -u --recursive --new-file v2.1.9/linux/net/ipv4/arp.c linux/net/ipv4/arp.c
@@ -2179,20 +2179,18 @@
 			if (!suser())
 				return -EPERM;
 		case SIOCGARP:
-			err = verify_area(VERIFY_READ, arg, sizeof(struct arpreq));
+			err = copy_from_user(&r, arg, sizeof(struct arpreq));
 			if (err)
-				return err;
-			copy_from_user(&r, arg, sizeof(struct arpreq));
+				return -EFAULT; 
 			break;
 		case OLD_SIOCDARP:
 		case OLD_SIOCSARP:
 			if (!suser())
 				return -EPERM;
 		case OLD_SIOCGARP:
-			err = verify_area(VERIFY_READ, arg, sizeof(struct arpreq_old));
+			err = copy_from_user(&r, arg, sizeof(struct arpreq_old));
 			if (err)
-				return err;
-			copy_from_user(&r, arg, sizeof(struct arpreq_old));
+				return -EFAULT; 
 			memset(&r.arp_dev, 0, sizeof(r.arp_dev));
 			break;
 		default:
@@ -2250,17 +2248,15 @@
 			}
 			return err;
 		case SIOCGARP:
-			err = verify_area(VERIFY_WRITE, arg, sizeof(struct arpreq));
-			if (err)
-				return err;
 			err = arp_req_get(&r, dev);
 			if (!err)
-				copy_to_user(arg, &r, sizeof(r));
+			{
+				err = copy_to_user(arg, &r, sizeof(r));
+				if (err)
+					err = -EFAULT;
+			}
 			return err;
 		case OLD_SIOCGARP:
-			err = verify_area(VERIFY_WRITE, arg, sizeof(struct arpreq_old));
-			if (err)
-				return err;
 			r.arp_flags &= ~ATF_PUBL;
 			err = arp_req_get(&r, dev);
 			if (err < 0)
@@ -2269,7 +2265,11 @@
 				err = arp_req_get(&r, dev);
 			}
 			if (!err)
-				copy_to_user(arg, &r, sizeof(struct arpreq_old));
+			{
+				err = copy_to_user(arg, &r, sizeof(struct arpreq_old));
+				if (err)
+					err = -EFAULT;
+			}
 			return err;
 	}
 	/*NOTREACHED*/

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov