[SSI] openssi/kernel/include/cluster/ssi rcopy_uaccess.h, 1.4, 1.5 socket.h, 1.7, 1.8

Roger Tsang <[email protected]>
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/include/cluster/ssi
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv1388/include/cluster/ssi

Modified Files:
      Tag: OPENSSI-FC
	rcopy_uaccess.h socket.h 
Log Message:
Multiple bug fixes. See ChangeLog.


Index: rcopy_uaccess.h
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/include/cluster/ssi/rcopy_uaccess.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rcopy_uaccess.h	24 Mar 2005 19:54:56 -0000	1.4
+++ rcopy_uaccess.h	17 Dec 2009 06:43:51 -0000	1.5
@@ -49,79 +49,67 @@
 static inline unsigned long __must_check
 __copy_to_user_inatomic(void *to, const void *from, unsigned long n)
 {
-	unsigned long ret;
-
-	if (ssi_rcopy_is_remote(to))
+	if (ssi_rcopy_is_remote(to)) {
 		panic("%s:Cannot go remote\n", __FUNCTION__);
-	else
-		ret = __copy_to_user_inatomic_lcl(to, from, n);
-
-	return ret;
+		for (;;) ;
+	} else
+		return __copy_to_user_inatomic_lcl(to, from, n);
 }
 
 static inline unsigned long __must_check
 __copy_to_user_inatomic_ssi(void *to, const void *from, unsigned long n)
 {
-	unsigned long ret;
-
 	if (ssi_rcopy_is_remote(to))
-		ret = ssi_rcopy_to_user(to, from, n);
-	else
-		ret = __copy_to_user_inatomic_lcl(to, from, n);
+		return ssi_rcopy_to_user(to, from, n);
 
-	return ret;
+	return __copy_to_user_inatomic_lcl(to, from, n);
 }
 
 static inline unsigned long
 copy_to_user(void *to, const void *from, unsigned long n)
 {
-	unsigned long ret;
-
-	if (ssi_rcopy_is_remote(to))
-		ret = ssi_rcopy_to_user(to, from, n);
-	else
-		ret = copy_to_user_lcl(to, from, n);
+	if (ssi_rcopy_is_remote(to)) {
+		BUG_ON((long) n < 0);
+		if (access_ok(VERIFY_WRITE, to, n))
+			n = ssi_rcopy_to_user(to, from, n);
+	} else
+		n = copy_to_user_lcl(to, from, n);
 
-	return ret;
+	return n;
 }
 
 static inline unsigned long
 __copy_from_user_inatomic(void *to, const void *from, unsigned long n)
 {
-	unsigned long ret;
-
-	if (ssi_rcopy_is_remote(from))
+	if (ssi_rcopy_is_remote(from)) {
 		panic("%s:Cannot go remote\n", __FUNCTION__);
-	else
-		ret = __copy_from_user_inatomic_lcl(to, from, n);
-
-	return ret;
+		for (;;) ;
+	} else
+		return __copy_from_user_inatomic_lcl(to, from, n);
 }
 
 static inline unsigned long
 __copy_from_user_inatomic_ssi(void *to, const void *from, unsigned long n)
 {
-	unsigned long ret;
-
 	if (ssi_rcopy_is_remote(from))
-		ret = ssi_rcopy_from_user(to, from, n);
-	else
-		ret = __copy_from_user_inatomic_lcl(to, from, n);
+		return ssi_rcopy_from_user(to, from, n);
 
-	return ret;
+	return __copy_from_user_inatomic_lcl(to, from, n);
 }
 
 static inline unsigned long
 copy_from_user(void *to, const void *from, unsigned long n)
 {
-	unsigned long ret;
-
-	if (ssi_rcopy_is_remote(from))
-		ret = ssi_rcopy_from_user(to, from, n);
-	else
-		ret = copy_from_user_lcl(to, from, n);
+	if (ssi_rcopy_is_remote(from)) {
+		BUG_ON((long) n < 0);
+		if (access_ok(VERIFY_READ, from, n))
+			n = ssi_rcopy_from_user(to, from, n);
+		else
+			memset(to, 0, n);
+	} else
+		n = copy_from_user_lcl(to, from, n);
 
-	return ret;
+	return n;
 }
 
 #define __get_user(x, ptr)						\
@@ -189,40 +177,28 @@
 static inline long
 strlen_user(const char *str)
 {
-	unsigned long ret;
-
 	if (ssi_rcopy_is_remote(str))
-		ret = ssi_rcopy_strnlen_user(str, ~0L >> 1);
-	else
-		ret = strlen_user_lcl(str);
+		return ssi_rcopy_strnlen_user(str, ~0L >> 1);
 
-	return ret;
+	return strlen_user_lcl(str);
 }
 
 static inline long
 strnlen_user(const char *str, long len)
 {
-	unsigned long ret;
-
 	if (ssi_rcopy_is_remote(str))
-		ret = ssi_rcopy_strnlen_user(str, len);
-	else
-		ret = strnlen_user_lcl(str, len);
+		return ssi_rcopy_strnlen_user(str, len);
 
-	return ret;
+	return strnlen_user_lcl(str, len);
 }
 
 static inline long
 strncpy_from_user(char *to, const char *from,  long count)
 {
-	long ret;
-
 	if (ssi_rcopy_is_remote(from))
-		ret = ssi_rcopy_strncpy_from_user(to, from, count);
-	else
-		ret = strncpy_from_user_lcl(to, from, count);
+		return ssi_rcopy_strncpy_from_user(to, from, count);
 
-	return ret;
+	return strncpy_from_user_lcl(to, from, count);
 }
 
 #else

Index: socket.h
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/include/cluster/ssi/socket.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- socket.h	10 Oct 2008 08:10:33 -0000	1.7
+++ socket.h	17 Dec 2009 06:43:51 -0000	1.8
@@ -83,7 +83,16 @@
 		return 0;
 
 	rfb = rmtfb_newcli(file, sock->ssi_rfb_id, sock->ssi_rfb_svr, 1);
+#ifdef RMTFB_REFCNT_FIX
+	if (IS_ERR(rfb))
+		return PTR_ERR(rfb);
+
+	rmtfb_putcli(rfb);
+	/* rfb is still held by file->private_data */
+	return 0;
+#else
 	return IS_ERR(rfb) ? PTR_ERR(rfb) : 0;
+#endif
 }
 
 static inline int ssi_localsocket(struct socket *sock)


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.