patch-2.1.38 linux/fs/autofs/root.c

Next file: linux/fs/autofs/waitq.c
Previous file: linux/fs/autofs/init.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.37/linux/fs/autofs/root.c linux/fs/autofs/root.c
@@ -335,9 +335,16 @@
 	int rv;
 	unsigned long ntimeout;
 
+#if LINUX_VERSION_CODE < kver(2,1,0)
+	if ( (rv = verify_area(VERIFY_WRITE, p, sizeof(unsigned long))) )
+		return rv;
+	ntimeout = get_user(p);
+	put_user(sbi->exp_timeout/HZ, p);
+#else
 	if ( (rv = get_user(ntimeout, p)) ||
 	     (rv = put_user(sbi->exp_timeout/HZ, p)) )
 		return rv;
+#endif
 
 	if ( ntimeout > ULONG_MAX/HZ )
 		sbi->exp_timeout = 0;
@@ -347,6 +354,20 @@
 	return 0;
 }
 
+/* Return protocol version */
+static inline int autofs_get_protover(int *p)
+{
+#if LINUX_VERSION_CODE < kver(2,1,0)
+	int rv;
+	if ( (rv = verify_area(VERIFY_WRITE, p, sizeof(int))) )
+		return rv;
+	put_user(AUTOFS_PROTO_VERSION, p);
+	return 0;
+#else
+	return put_user(AUTOFS_PROTO_VERSION, p);
+#endif
+}
+
 /* Perform an expiry operation */
 static inline int autofs_expire_run(struct autofs_sb_info *sbi,
 				    struct autofs_packet_expire *pkt_p)
@@ -402,7 +423,7 @@
 		autofs_catatonic_mode(sbi);
 		return 0;
 	case AUTOFS_IOC_PROTOVER: /* Get protocol version */
-		return put_user(AUTOFS_PROTO_VERSION, (int *)arg);
+		return autofs_get_protover((int *)arg);
 	case AUTOFS_IOC_SETTIMEOUT:
 		return autofs_get_set_timeout(sbi,(unsigned long *)arg);
 	case AUTOFS_IOC_EXPIRE:

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