patch-2.2.7 linux/net/socket.c

Next file: linux/scripts/ksymoops/oops.c
Previous file: linux/net/sched/sch_sfq.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.6/linux/net/socket.c linux/net/socket.c
@@ -279,8 +279,8 @@
 
 	inode->i_mode = S_IFSOCK|S_IRWXUGO;
 	inode->i_sock = 1;
-	inode->i_uid = current->uid;
-	inode->i_gid = current->gid;
+	inode->i_uid = current->fsuid;
+	inode->i_gid = current->fsgid;
 
 	sock->inode = inode;
 	init_waitqueue(&sock->wait);
@@ -1135,7 +1135,7 @@
 	/* Check whether to allocate the iovec area*/
 	err = -ENOMEM;
 	iov_size = msg_sys.msg_iovlen * sizeof(struct iovec);
-	if (msg_sys.msg_iovlen > 1 /* UIO_FASTIOV */) {
+	if (msg_sys.msg_iovlen > UIO_FASTIOV) {
 		iov = sock_kmalloc(sock->sk, iov_size, GFP_KERNEL);
 		if (!iov)
 			goto out_put;
@@ -1147,6 +1147,11 @@
 		goto out_freeiov;
 	total_len = err;
 
+	err = -ENOBUFS;
+
+	/* msg_controllen must fit to int */
+	if (msg_sys.msg_controllen > INT_MAX)
+		goto out_freeiov;
 	ctl_len = msg_sys.msg_controllen; 
 	if (ctl_len) 
 	{

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