patch-2.1.89 linux/net/core/sock.c

Next file: linux/net/core/sysctl_net_core.c
Previous file: linux/net/core/skbuff.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.88/linux/net/core/sock.c linux/net/core/sock.c
@@ -298,31 +298,19 @@
 				sk->bound_dev_if = 0;
 			}
 			else {
-				if (copy_from_user(&req, optval, sizeof(req)) < 0)
+				if (copy_from_user(&req, optval, sizeof(req)))
 					return -EFAULT;
 
 				/* Remove any cached route for this socket. */
-				if (sk->dst_cache) {
-					ip_rt_put((struct rtable*)sk->dst_cache);
-					sk->dst_cache = NULL;
-				}
+				dst_release(xchg(&sk->dst_cache, NULL));
 
 				if (req.ifr_ifrn.ifrn_name[0] == '\0') {
 					sk->bound_dev_if = 0;
-				}
-				else {
+				} else {
 					struct device *dev = dev_get(req.ifr_ifrn.ifrn_name);
 					if (!dev)
 						return -EINVAL;
 					sk->bound_dev_if = dev->ifindex;
-					if (sk->daddr) {
-						int ret;
-						ret = ip_route_output((struct rtable**)&sk->dst_cache,
-								     sk->daddr, sk->saddr,
-								     sk->ip_tos, sk->bound_dev_if);
-						if (ret)
-							return ret;
-					}
 				}
 			}
 			return 0;
@@ -580,12 +568,8 @@
 		 */
 		atomic_add(size, &sk->wmem_alloc);
 		mem = kmalloc(size, priority);
-		if (mem) {
-			/* Recheck because kmalloc might sleep */
-			if (atomic_read(&sk->wmem_alloc)+size < sk->sndbuf)
-				return mem; 
-			kfree_s(mem, size);
-		} 
+		if (mem)
+			return mem; 
 		atomic_sub(size, &sk->wmem_alloc);
 	}
 	return mem;
@@ -910,7 +894,7 @@
 	return -EOPNOTSUPP;
 }
 
-unsigned int sock_no_poll(struct socket *sock, poll_table *pt)
+unsigned int sock_no_poll(struct file * file, struct socket *sock, poll_table *pt)
 {
 	return -EOPNOTSUPP;
 }

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