aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-04-10 14:30:45 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-10 14:30:45 -0400
commit06eb4eafbdc0796d741d139a44f1253278da8611 (patch)
treefbdb44317130c371928154c9e6903e699fe2b995 /net
parent32ed53b83ea5ec26a4dba90e18f5e0ff6c71eb48 (diff)
parentf68e556e23d1a4176b563bcb25d8baf2c5313f91 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net')
-rw-r--r--net/802/fc.c1
-rw-r--r--net/802/fddi.c1
-rw-r--r--net/802/hippi.c1
-rw-r--r--net/802/tr.c1
-rw-r--r--net/9p/client.c26
-rw-r--r--net/atm/clip.c1
-rw-r--r--net/ax25/af_ax25.c1
-rw-r--r--net/ax25/ax25_addr.c1
-rw-r--r--net/ax25/ax25_dev.c1
-rw-r--r--net/ax25/ax25_ds_in.c1
-rw-r--r--net/ax25/ax25_ds_subr.c1
-rw-r--r--net/ax25/ax25_ds_timer.c1
-rw-r--r--net/ax25/ax25_iface.c1
-rw-r--r--net/ax25/ax25_in.c1
-rw-r--r--net/ax25/ax25_ip.c1
-rw-r--r--net/ax25/ax25_out.c1
-rw-r--r--net/ax25/ax25_route.c1
-rw-r--r--net/ax25/ax25_std_in.c1
-rw-r--r--net/ax25/ax25_std_subr.c1
-rw-r--r--net/ax25/ax25_std_timer.c1
-rw-r--r--net/ax25/ax25_subr.c1
-rw-r--r--net/ax25/ax25_timer.c1
-rw-r--r--net/ax25/ax25_uid.c1
-rw-r--r--net/bluetooth/bnep/sock.c1
-rw-r--r--net/bluetooth/cmtp/sock.c1
-rw-r--r--net/bluetooth/hci_conn.c1
-rw-r--r--net/bluetooth/hci_core.c1
-rw-r--r--net/bluetooth/hci_event.c1
-rw-r--r--net/bluetooth/hci_sock.c4
-rw-r--r--net/bluetooth/l2cap_core.c1
-rw-r--r--net/bluetooth/rfcomm/sock.c1
-rw-r--r--net/bluetooth/sco.c1
-rw-r--r--net/ceph/ceph_common.c26
-rw-r--r--net/ceph/messenger.c456
-rw-r--r--net/ceph/osdmap.c3
-rw-r--r--net/compat.c65
-rw-r--r--net/core/datagram.c1
-rw-r--r--net/core/dev.c59
-rw-r--r--net/core/dev_addr_lists.c3
-rw-r--r--net/core/filter.c10
-rw-r--r--net/core/gen_estimator.c1
-rw-r--r--net/core/rtnetlink.c1
-rw-r--r--net/core/scm.c1
-rw-r--r--net/core/skbuff.c5
-rw-r--r--net/core/sock.c1
-rw-r--r--net/core/utils.c1
-rw-r--r--net/decnet/af_decnet.c1
-rw-r--r--net/decnet/dn_dev.c1
-rw-r--r--net/decnet/dn_nsp_in.c1
-rw-r--r--net/decnet/dn_nsp_out.c1
-rw-r--r--net/econet/af_econet.c1
-rw-r--r--net/ethernet/eth.c1
-rw-r--r--net/ipv4/af_inet.c1
-rw-r--r--net/ipv4/arp.c1
-rw-r--r--net/ipv4/devinet.c1
-rw-r--r--net/ipv4/fib_frontend.c1
-rw-r--r--net/ipv4/fib_semantics.c1
-rw-r--r--net/ipv4/fib_trie.c1
-rw-r--r--net/ipv4/icmp.c1
-rw-r--r--net/ipv4/igmp.c1
-rw-r--r--net/ipv4/ip_input.c1
-rw-r--r--net/ipv4/ip_output.c1
-rw-r--r--net/ipv4/ipmr.c1
-rw-r--r--net/ipv4/ping.c1
-rw-r--r--net/ipv4/route.c1
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/udp.c1
-rw-r--r--net/ipv6/af_inet6.c1
-rw-r--r--net/ipv6/icmp.c1
-rw-r--r--net/ipv6/ip6mr.c1
-rw-r--r--net/ipv6/mcast.c2
-rw-r--r--net/irda/irlan/irlan_client.c1
-rw-r--r--net/irda/irlan/irlan_common.c1
-rw-r--r--net/irda/irlan/irlan_provider.c1
-rw-r--r--net/irda/timer.c1
-rw-r--r--net/lapb/lapb_iface.c1
-rw-r--r--net/lapb/lapb_in.c1
-rw-r--r--net/lapb/lapb_out.c1
-rw-r--r--net/lapb/lapb_subr.c1
-rw-r--r--net/lapb/lapb_timer.c1
-rw-r--r--net/mac80211/debugfs.c12
-rw-r--r--net/mac80211/debugfs.h1
-rw-r--r--net/mac80211/debugfs_key.c4
-rw-r--r--net/mac80211/debugfs_netdev.c2
-rw-r--r--net/mac80211/debugfs_sta.c4
-rw-r--r--net/mac80211/rate.c2
-rw-r--r--net/netfilter/ipvs/ip_vs_app.c1
-rw-r--r--net/netfilter/ipvs/ip_vs_proto.c1
-rw-r--r--net/netfilter/nf_conntrack_core.c1
-rw-r--r--net/netfilter/nfnetlink.c1
-rw-r--r--net/netfilter/xt_CT.c28
-rw-r--r--net/netlink/af_netlink.c24
-rw-r--r--net/netrom/af_netrom.c1
-rw-r--r--net/netrom/nr_dev.c1
-rw-r--r--net/netrom/nr_in.c1
-rw-r--r--net/netrom/nr_out.c1
-rw-r--r--net/netrom/nr_route.c1
-rw-r--r--net/netrom/nr_subr.c1
-rw-r--r--net/netrom/nr_timer.c1
-rw-r--r--net/openvswitch/datapath.c1
-rw-r--r--net/packet/af_packet.c1
-rw-r--r--net/phonet/pep.c3
-rw-r--r--net/rose/af_rose.c1
-rw-r--r--net/rose/rose_dev.c1
-rw-r--r--net/rose/rose_in.c1
-rw-r--r--net/rose/rose_link.c1
-rw-r--r--net/rose/rose_out.c1
-rw-r--r--net/rose/rose_route.c1
-rw-r--r--net/rose/rose_subr.c1
-rw-r--r--net/rose/rose_timer.c1
-rw-r--r--net/sctp/socket.c5
-rw-r--r--net/socket.c24
-rw-r--r--net/sunrpc/cache.c2
-rw-r--r--net/sunrpc/clnt.c1
-rw-r--r--net/sunrpc/rpc_pipe.c5
-rw-r--r--net/sunrpc/rpcb_clnt.c2
-rw-r--r--net/sunrpc/svcauth_unix.c2
-rw-r--r--net/sunrpc/svcsock.c2
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma.c1
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_marshal.c66
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_recvfrom.c20
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_sendto.c26
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c10
-rw-r--r--net/sunrpc/xprtrdma/xprt_rdma.h7
-rw-r--r--net/sunrpc/xprtsock.c1
-rw-r--r--net/wireless/debugfs.c10
126 files changed, 470 insertions, 544 deletions
diff --git a/net/802/fc.c b/net/802/fc.c
index bd345f3d29f8..b324e31401a9 100644
--- a/net/802/fc.c
+++ b/net/802/fc.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14#include <asm/system.h>
15#include <linux/types.h> 14#include <linux/types.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/string.h> 16#include <linux/string.h>
diff --git a/net/802/fddi.c b/net/802/fddi.c
index 94b3ad08f39a..5ab25cd4314b 100644
--- a/net/802/fddi.c
+++ b/net/802/fddi.c
@@ -27,7 +27,6 @@
27 */ 27 */
28 28
29#include <linux/module.h> 29#include <linux/module.h>
30#include <asm/system.h>
31#include <linux/types.h> 30#include <linux/types.h>
32#include <linux/kernel.h> 31#include <linux/kernel.h>
33#include <linux/string.h> 32#include <linux/string.h>
diff --git a/net/802/hippi.c b/net/802/hippi.c
index 91aca8780fd0..056794e66375 100644
--- a/net/802/hippi.c
+++ b/net/802/hippi.c
@@ -35,7 +35,6 @@
35#include <net/arp.h> 35#include <net/arp.h>
36#include <net/sock.h> 36#include <net/sock.h>
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
38#include <asm/system.h>
39 38
40/* 39/*
41 * Create the HIPPI MAC header for an arbitrary protocol layer 40 * Create the HIPPI MAC header for an arbitrary protocol layer
diff --git a/net/802/tr.c b/net/802/tr.c
index 5e20cf8a074b..b9a3a145e348 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -16,7 +16,6 @@
16 */ 16 */
17 17
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include <asm/system.h>
20#include <linux/module.h> 19#include <linux/module.h>
21#include <linux/types.h> 20#include <linux/types.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
diff --git a/net/9p/client.c b/net/9p/client.c
index 776618cd2be5..b23a17c431c8 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -740,10 +740,18 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
740 c->status = Disconnected; 740 c->status = Disconnected;
741 goto reterr; 741 goto reterr;
742 } 742 }
743again:
743 /* Wait for the response */ 744 /* Wait for the response */
744 err = wait_event_interruptible(*req->wq, 745 err = wait_event_interruptible(*req->wq,
745 req->status >= REQ_STATUS_RCVD); 746 req->status >= REQ_STATUS_RCVD);
746 747
748 if ((err == -ERESTARTSYS) && (c->status == Connected)
749 && (type == P9_TFLUSH)) {
750 sigpending = 1;
751 clear_thread_flag(TIF_SIGPENDING);
752 goto again;
753 }
754
747 if (req->status == REQ_STATUS_ERROR) { 755 if (req->status == REQ_STATUS_ERROR) {
748 p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); 756 p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err);
749 err = req->t_err; 757 err = req->t_err;
@@ -1420,6 +1428,7 @@ int p9_client_clunk(struct p9_fid *fid)
1420 int err; 1428 int err;
1421 struct p9_client *clnt; 1429 struct p9_client *clnt;
1422 struct p9_req_t *req; 1430 struct p9_req_t *req;
1431 int retries = 0;
1423 1432
1424 if (!fid) { 1433 if (!fid) {
1425 pr_warn("%s (%d): Trying to clunk with NULL fid\n", 1434 pr_warn("%s (%d): Trying to clunk with NULL fid\n",
@@ -1428,7 +1437,9 @@ int p9_client_clunk(struct p9_fid *fid)
1428 return 0; 1437 return 0;
1429 } 1438 }
1430 1439
1431 p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d\n", fid->fid); 1440again:
1441 p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d (try %d)\n", fid->fid,
1442 retries);
1432 err = 0; 1443 err = 0;
1433 clnt = fid->clnt; 1444 clnt = fid->clnt;
1434 1445
@@ -1444,8 +1455,14 @@ int p9_client_clunk(struct p9_fid *fid)
1444error: 1455error:
1445 /* 1456 /*
1446 * Fid is not valid even after a failed clunk 1457 * Fid is not valid even after a failed clunk
1458 * If interrupted, retry once then give up and
1459 * leak fid until umount.
1447 */ 1460 */
1448 p9_fid_destroy(fid); 1461 if (err == -ERESTARTSYS) {
1462 if (retries++ == 0)
1463 goto again;
1464 } else
1465 p9_fid_destroy(fid);
1449 return err; 1466 return err;
1450} 1467}
1451EXPORT_SYMBOL(p9_client_clunk); 1468EXPORT_SYMBOL(p9_client_clunk);
@@ -1470,7 +1487,10 @@ int p9_client_remove(struct p9_fid *fid)
1470 1487
1471 p9_free_req(clnt, req); 1488 p9_free_req(clnt, req);
1472error: 1489error:
1473 p9_fid_destroy(fid); 1490 if (err == -ERESTARTSYS)
1491 p9_client_clunk(fid);
1492 else
1493 p9_fid_destroy(fid);
1474 return err; 1494 return err;
1475} 1495}
1476EXPORT_SYMBOL(p9_client_remove); 1496EXPORT_SYMBOL(p9_client_remove);
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 5de42ea309bc..8ae3a7879335 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -37,7 +37,6 @@
37#include <linux/param.h> /* for HZ */ 37#include <linux/param.h> /* for HZ */
38#include <linux/uaccess.h> 38#include <linux/uaccess.h>
39#include <asm/byteorder.h> /* for htons etc. */ 39#include <asm/byteorder.h> /* for htons etc. */
40#include <asm/system.h> /* save/restore_flags */
41#include <linux/atomic.h> 40#include <linux/atomic.h>
42 41
43#include "common.h" 42#include "common.h"
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 3cd0a0dc91cb..0906c194a413 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -33,7 +33,6 @@
33#include <linux/skbuff.h> 33#include <linux/skbuff.h>
34#include <net/sock.h> 34#include <net/sock.h>
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
36#include <asm/system.h>
37#include <linux/fcntl.h> 36#include <linux/fcntl.h>
38#include <linux/termios.h> /* For TIOCINQ/OUTQ */ 37#include <linux/termios.h> /* For TIOCINQ/OUTQ */
39#include <linux/mm.h> 38#include <linux/mm.h>
diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c
index 7e7964dd987b..9162409559cf 100644
--- a/net/ax25/ax25_addr.c
+++ b/net/ax25/ax25_addr.c
@@ -22,7 +22,6 @@
22#include <linux/skbuff.h> 22#include <linux/skbuff.h>
23#include <net/sock.h> 23#include <net/sock.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/system.h>
26#include <linux/fcntl.h> 25#include <linux/fcntl.h>
27#include <linux/mm.h> 26#include <linux/mm.h>
28#include <linux/interrupt.h> 27#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c
index c1cb982f6e86..d0de30e89591 100644
--- a/net/ax25/ax25_dev.c
+++ b/net/ax25/ax25_dev.c
@@ -24,7 +24,6 @@
24#include <linux/skbuff.h> 24#include <linux/skbuff.h>
25#include <net/sock.h> 25#include <net/sock.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/system.h>
28#include <linux/fcntl.h> 27#include <linux/fcntl.h>
29#include <linux/mm.h> 28#include <linux/mm.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_ds_in.c b/net/ax25/ax25_ds_in.c
index 8273b1200eee..9bd31e88aeca 100644
--- a/net/ax25/ax25_ds_in.c
+++ b/net/ax25/ax25_ds_in.c
@@ -23,7 +23,6 @@
23#include <net/sock.h> 23#include <net/sock.h>
24#include <net/tcp_states.h> 24#include <net/tcp_states.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/system.h>
27#include <linux/fcntl.h> 26#include <linux/fcntl.h>
28#include <linux/mm.h> 27#include <linux/mm.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_ds_subr.c b/net/ax25/ax25_ds_subr.c
index 85816e612dc0..5ea7fd3e2af9 100644
--- a/net/ax25/ax25_ds_subr.c
+++ b/net/ax25/ax25_ds_subr.c
@@ -24,7 +24,6 @@
24#include <linux/skbuff.h> 24#include <linux/skbuff.h>
25#include <net/sock.h> 25#include <net/sock.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/system.h>
28#include <linux/fcntl.h> 27#include <linux/fcntl.h>
29#include <linux/mm.h> 28#include <linux/mm.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c
index c7d81436213d..993c439b4f71 100644
--- a/net/ax25/ax25_ds_timer.c
+++ b/net/ax25/ax25_ds_timer.c
@@ -25,7 +25,6 @@
25#include <linux/skbuff.h> 25#include <linux/skbuff.h>
26#include <net/sock.h> 26#include <net/sock.h>
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <asm/system.h>
29#include <linux/fcntl.h> 28#include <linux/fcntl.h>
30#include <linux/mm.h> 29#include <linux/mm.h>
31#include <linux/interrupt.h> 30#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c
index 60b545e2822a..7d5f24b82cc8 100644
--- a/net/ax25/ax25_iface.c
+++ b/net/ax25/ax25_iface.c
@@ -24,7 +24,6 @@
24#include <linux/skbuff.h> 24#include <linux/skbuff.h>
25#include <net/sock.h> 25#include <net/sock.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/system.h>
28#include <linux/fcntl.h> 27#include <linux/fcntl.h>
29#include <linux/mm.h> 28#include <linux/mm.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 9bb776541203..96f4cab3a2f9 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -27,7 +27,6 @@
27#include <net/sock.h> 27#include <net/sock.h>
28#include <net/tcp_states.h> 28#include <net/tcp_states.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <asm/system.h>
31#include <linux/fcntl.h> 30#include <linux/fcntl.h>
32#include <linux/mm.h> 31#include <linux/mm.h>
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c
index cf0c47a26530..846ae4e2b115 100644
--- a/net/ax25/ax25_ip.c
+++ b/net/ax25/ax25_ip.c
@@ -24,7 +24,6 @@
24#include <linux/skbuff.h> 24#include <linux/skbuff.h>
25#include <net/sock.h> 25#include <net/sock.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/system.h>
28#include <linux/fcntl.h> 27#include <linux/fcntl.h>
29#include <linux/termios.h> /* For TIOCINQ/OUTQ */ 28#include <linux/termios.h> /* For TIOCINQ/OUTQ */
30#include <linux/mm.h> 29#include <linux/mm.h>
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index 37507d806f65..be8a25e0db65 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -27,7 +27,6 @@
27#include <linux/netfilter.h> 27#include <linux/netfilter.h>
28#include <net/sock.h> 28#include <net/sock.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <asm/system.h>
31#include <linux/fcntl.h> 30#include <linux/fcntl.h>
32#include <linux/mm.h> 31#include <linux/mm.h>
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index 87fddab22e0f..a65588040b9e 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -32,7 +32,6 @@
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <net/sock.h> 33#include <net/sock.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <asm/system.h>
36#include <linux/fcntl.h> 35#include <linux/fcntl.h>
37#include <linux/mm.h> 36#include <linux/mm.h>
38#include <linux/interrupt.h> 37#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_std_in.c b/net/ax25/ax25_std_in.c
index a8eef88d8652..3fbf8f7b2cf4 100644
--- a/net/ax25/ax25_std_in.c
+++ b/net/ax25/ax25_std_in.c
@@ -30,7 +30,6 @@
30#include <net/sock.h> 30#include <net/sock.h>
31#include <net/tcp_states.h> 31#include <net/tcp_states.h>
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <asm/system.h>
34#include <linux/fcntl.h> 33#include <linux/fcntl.h>
35#include <linux/mm.h> 34#include <linux/mm.h>
36#include <linux/interrupt.h> 35#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_std_subr.c b/net/ax25/ax25_std_subr.c
index 277f81bb979a..8b66a41e538f 100644
--- a/net/ax25/ax25_std_subr.c
+++ b/net/ax25/ax25_std_subr.c
@@ -21,7 +21,6 @@
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <net/sock.h> 22#include <net/sock.h>
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24#include <asm/system.h>
25#include <linux/fcntl.h> 24#include <linux/fcntl.h>
26#include <linux/mm.h> 25#include <linux/mm.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_std_timer.c b/net/ax25/ax25_std_timer.c
index 96e4b9273250..004467c9e6e1 100644
--- a/net/ax25/ax25_std_timer.c
+++ b/net/ax25/ax25_std_timer.c
@@ -25,7 +25,6 @@
25#include <net/sock.h> 25#include <net/sock.h>
26#include <net/tcp_states.h> 26#include <net/tcp_states.h>
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <asm/system.h>
29#include <linux/fcntl.h> 28#include <linux/fcntl.h>
30#include <linux/mm.h> 29#include <linux/mm.h>
31#include <linux/interrupt.h> 30#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
index c6715ee4ab8f..1997538a5d23 100644
--- a/net/ax25/ax25_subr.c
+++ b/net/ax25/ax25_subr.c
@@ -26,7 +26,6 @@
26#include <net/sock.h> 26#include <net/sock.h>
27#include <net/tcp_states.h> 27#include <net/tcp_states.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/system.h>
30#include <linux/fcntl.h> 29#include <linux/fcntl.h>
31#include <linux/mm.h> 30#include <linux/mm.h>
32#include <linux/interrupt.h> 31#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_timer.c b/net/ax25/ax25_timer.c
index db29ea71e80a..c3cffa79bafb 100644
--- a/net/ax25/ax25_timer.c
+++ b/net/ax25/ax25_timer.c
@@ -29,7 +29,6 @@
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <net/sock.h> 30#include <net/sock.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32#include <asm/system.h>
33#include <linux/fcntl.h> 32#include <linux/fcntl.h>
34#include <linux/mm.h> 33#include <linux/mm.h>
35#include <linux/interrupt.h> 34#include <linux/interrupt.h>
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index 4c83137b5954..e3c579ba6325 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -26,7 +26,6 @@
26#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27#include <net/sock.h> 27#include <net/sock.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/system.h>
30#include <linux/fcntl.h> 29#include <linux/fcntl.h>
31#include <linux/mm.h> 30#include <linux/mm.h>
32#include <linux/interrupt.h> 31#include <linux/interrupt.h>
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
index 9f9c8dcd8af0..180bfc45810d 100644
--- a/net/bluetooth/bnep/sock.c
+++ b/net/bluetooth/bnep/sock.c
@@ -42,7 +42,6 @@
42#include <linux/uaccess.h> 42#include <linux/uaccess.h>
43#include <net/sock.h> 43#include <net/sock.h>
44 44
45#include <asm/system.h>
46 45
47#include "bnep.h" 46#include "bnep.h"
48 47
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index 1230faaac29b..311668d14571 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -39,7 +39,6 @@
39 39
40#include <linux/isdn/capilli.h> 40#include <linux/isdn/capilli.h>
41 41
42#include <asm/system.h>
43 42
44#include "cmtp.h" 43#include "cmtp.h"
45 44
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 947172bf1621..5238b6b3ea6a 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -37,7 +37,6 @@
37#include <linux/interrupt.h> 37#include <linux/interrupt.h>
38#include <net/sock.h> 38#include <net/sock.h>
39 39
40#include <asm/system.h>
41#include <linux/uaccess.h> 40#include <linux/uaccess.h>
42#include <asm/unaligned.h> 41#include <asm/unaligned.h>
43 42
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 59ec99eb739b..e33af63a884a 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -45,7 +45,6 @@
45#include <linux/crypto.h> 45#include <linux/crypto.h>
46#include <net/sock.h> 46#include <net/sock.h>
47 47
48#include <asm/system.h>
49#include <linux/uaccess.h> 48#include <linux/uaccess.h>
50#include <asm/unaligned.h> 49#include <asm/unaligned.h>
51 50
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index badb7851d116..b37531094c49 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -37,7 +37,6 @@
37#include <linux/interrupt.h> 37#include <linux/interrupt.h>
38#include <net/sock.h> 38#include <net/sock.h>
39 39
40#include <asm/system.h>
41#include <linux/uaccess.h> 40#include <linux/uaccess.h>
42#include <asm/unaligned.h> 41#include <asm/unaligned.h>
43 42
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 63afd234283e..5914623f426a 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -42,7 +42,6 @@
42#include <linux/ioctl.h> 42#include <linux/ioctl.h>
43#include <net/sock.h> 43#include <net/sock.h>
44 44
45#include <asm/system.h>
46#include <linux/uaccess.h> 45#include <linux/uaccess.h>
47#include <asm/unaligned.h> 46#include <asm/unaligned.h>
48 47
@@ -734,7 +733,8 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
734 data = &tv; 733 data = &tv;
735 len = sizeof(tv); 734 len = sizeof(tv);
736#ifdef CONFIG_COMPAT 735#ifdef CONFIG_COMPAT
737 if (msg->msg_flags & MSG_CMSG_COMPAT) { 736 if (!COMPAT_USE_64BIT_TIME &&
737 (msg->msg_flags & MSG_CMSG_COMPAT)) {
738 ctv.tv_sec = tv.tv_sec; 738 ctv.tv_sec = tv.tv_sec;
739 ctv.tv_usec = tv.tv_usec; 739 ctv.tv_usec = tv.tv_usec;
740 data = &ctv; 740 data = &ctv;
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 3e450f4a3125..b8e17e4dac8b 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -49,7 +49,6 @@
49#include <linux/crc16.h> 49#include <linux/crc16.h>
50#include <net/sock.h> 50#include <net/sock.h>
51 51
52#include <asm/system.h>
53#include <asm/unaligned.h> 52#include <asm/unaligned.h>
54 53
55#include <net/bluetooth/bluetooth.h> 54#include <net/bluetooth/bluetooth.h>
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 22169c3f1482..a55a43e9f70e 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -45,7 +45,6 @@
45#include <linux/security.h> 45#include <linux/security.h>
46#include <net/sock.h> 46#include <net/sock.h>
47 47
48#include <asm/system.h>
49#include <linux/uaccess.h> 48#include <linux/uaccess.h>
50 49
51#include <net/bluetooth/bluetooth.h> 50#include <net/bluetooth/bluetooth.h>
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 8bf26d1bc5c1..f6ab12907963 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -44,7 +44,6 @@
44#include <linux/security.h> 44#include <linux/security.h>
45#include <net/sock.h> 45#include <net/sock.h>
46 46
47#include <asm/system.h>
48#include <linux/uaccess.h> 47#include <linux/uaccess.h>
49 48
50#include <net/bluetooth/bluetooth.h> 49#include <net/bluetooth/bluetooth.h>
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 761ad9d6cc3b..cc913193d992 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -201,7 +201,9 @@ enum {
201 Opt_ip, 201 Opt_ip,
202 Opt_last_string, 202 Opt_last_string,
203 /* string args above */ 203 /* string args above */
204 Opt_share,
204 Opt_noshare, 205 Opt_noshare,
206 Opt_crc,
205 Opt_nocrc, 207 Opt_nocrc,
206}; 208};
207 209
@@ -217,7 +219,9 @@ static match_table_t opt_tokens = {
217 {Opt_key, "key=%s"}, 219 {Opt_key, "key=%s"},
218 {Opt_ip, "ip=%s"}, 220 {Opt_ip, "ip=%s"},
219 /* string args above */ 221 /* string args above */
222 {Opt_share, "share"},
220 {Opt_noshare, "noshare"}, 223 {Opt_noshare, "noshare"},
224 {Opt_crc, "crc"},
221 {Opt_nocrc, "nocrc"}, 225 {Opt_nocrc, "nocrc"},
222 {-1, NULL} 226 {-1, NULL}
223}; 227};
@@ -277,10 +281,11 @@ out:
277 return err; 281 return err;
278} 282}
279 283
280int ceph_parse_options(struct ceph_options **popt, char *options, 284struct ceph_options *
281 const char *dev_name, const char *dev_name_end, 285ceph_parse_options(char *options, const char *dev_name,
282 int (*parse_extra_token)(char *c, void *private), 286 const char *dev_name_end,
283 void *private) 287 int (*parse_extra_token)(char *c, void *private),
288 void *private)
284{ 289{
285 struct ceph_options *opt; 290 struct ceph_options *opt;
286 const char *c; 291 const char *c;
@@ -289,7 +294,7 @@ int ceph_parse_options(struct ceph_options **popt, char *options,
289 294
290 opt = kzalloc(sizeof(*opt), GFP_KERNEL); 295 opt = kzalloc(sizeof(*opt), GFP_KERNEL);
291 if (!opt) 296 if (!opt)
292 return err; 297 return ERR_PTR(-ENOMEM);
293 opt->mon_addr = kcalloc(CEPH_MAX_MON, sizeof(*opt->mon_addr), 298 opt->mon_addr = kcalloc(CEPH_MAX_MON, sizeof(*opt->mon_addr),
294 GFP_KERNEL); 299 GFP_KERNEL);
295 if (!opt->mon_addr) 300 if (!opt->mon_addr)
@@ -398,10 +403,16 @@ int ceph_parse_options(struct ceph_options **popt, char *options,
398 opt->mount_timeout = intval; 403 opt->mount_timeout = intval;
399 break; 404 break;
400 405
406 case Opt_share:
407 opt->flags &= ~CEPH_OPT_NOSHARE;
408 break;
401 case Opt_noshare: 409 case Opt_noshare:
402 opt->flags |= CEPH_OPT_NOSHARE; 410 opt->flags |= CEPH_OPT_NOSHARE;
403 break; 411 break;
404 412
413 case Opt_crc:
414 opt->flags &= ~CEPH_OPT_NOCRC;
415 break;
405 case Opt_nocrc: 416 case Opt_nocrc:
406 opt->flags |= CEPH_OPT_NOCRC; 417 opt->flags |= CEPH_OPT_NOCRC;
407 break; 418 break;
@@ -412,12 +423,11 @@ int ceph_parse_options(struct ceph_options **popt, char *options,
412 } 423 }
413 424
414 /* success */ 425 /* success */
415 *popt = opt; 426 return opt;
416 return 0;
417 427
418out: 428out:
419 ceph_destroy_options(opt); 429 ceph_destroy_options(opt);
420 return err; 430 return ERR_PTR(err);
421} 431}
422EXPORT_SYMBOL(ceph_parse_options); 432EXPORT_SYMBOL(ceph_parse_options);
423 433
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index ad5b70801f37..f0993af2ae4d 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -38,48 +38,54 @@ static char tag_keepalive = CEPH_MSGR_TAG_KEEPALIVE;
38static struct lock_class_key socket_class; 38static struct lock_class_key socket_class;
39#endif 39#endif
40 40
41/*
42 * When skipping (ignoring) a block of input we read it into a "skip
43 * buffer," which is this many bytes in size.
44 */
45#define SKIP_BUF_SIZE 1024
41 46
42static void queue_con(struct ceph_connection *con); 47static void queue_con(struct ceph_connection *con);
43static void con_work(struct work_struct *); 48static void con_work(struct work_struct *);
44static void ceph_fault(struct ceph_connection *con); 49static void ceph_fault(struct ceph_connection *con);
45 50
46/* 51/*
47 * nicely render a sockaddr as a string. 52 * Nicely render a sockaddr as a string. An array of formatted
53 * strings is used, to approximate reentrancy.
48 */ 54 */
49#define MAX_ADDR_STR 20 55#define ADDR_STR_COUNT_LOG 5 /* log2(# address strings in array) */
50#define MAX_ADDR_STR_LEN 60 56#define ADDR_STR_COUNT (1 << ADDR_STR_COUNT_LOG)
51static char addr_str[MAX_ADDR_STR][MAX_ADDR_STR_LEN]; 57#define ADDR_STR_COUNT_MASK (ADDR_STR_COUNT - 1)
52static DEFINE_SPINLOCK(addr_str_lock); 58#define MAX_ADDR_STR_LEN 64 /* 54 is enough */
53static int last_addr_str; 59
60static char addr_str[ADDR_STR_COUNT][MAX_ADDR_STR_LEN];
61static atomic_t addr_str_seq = ATOMIC_INIT(0);
62
63static struct page *zero_page; /* used in certain error cases */
54 64
55const char *ceph_pr_addr(const struct sockaddr_storage *ss) 65const char *ceph_pr_addr(const struct sockaddr_storage *ss)
56{ 66{
57 int i; 67 int i;
58 char *s; 68 char *s;
59 struct sockaddr_in *in4 = (void *)ss; 69 struct sockaddr_in *in4 = (struct sockaddr_in *) ss;
60 struct sockaddr_in6 *in6 = (void *)ss; 70 struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) ss;
61 71
62 spin_lock(&addr_str_lock); 72 i = atomic_inc_return(&addr_str_seq) & ADDR_STR_COUNT_MASK;
63 i = last_addr_str++;
64 if (last_addr_str == MAX_ADDR_STR)
65 last_addr_str = 0;
66 spin_unlock(&addr_str_lock);
67 s = addr_str[i]; 73 s = addr_str[i];
68 74
69 switch (ss->ss_family) { 75 switch (ss->ss_family) {
70 case AF_INET: 76 case AF_INET:
71 snprintf(s, MAX_ADDR_STR_LEN, "%pI4:%u", &in4->sin_addr, 77 snprintf(s, MAX_ADDR_STR_LEN, "%pI4:%hu", &in4->sin_addr,
72 (unsigned int)ntohs(in4->sin_port)); 78 ntohs(in4->sin_port));
73 break; 79 break;
74 80
75 case AF_INET6: 81 case AF_INET6:
76 snprintf(s, MAX_ADDR_STR_LEN, "[%pI6c]:%u", &in6->sin6_addr, 82 snprintf(s, MAX_ADDR_STR_LEN, "[%pI6c]:%hu", &in6->sin6_addr,
77 (unsigned int)ntohs(in6->sin6_port)); 83 ntohs(in6->sin6_port));
78 break; 84 break;
79 85
80 default: 86 default:
81 snprintf(s, MAX_ADDR_STR_LEN, "(unknown sockaddr family %d)", 87 snprintf(s, MAX_ADDR_STR_LEN, "(unknown sockaddr family %hu)",
82 (int)ss->ss_family); 88 ss->ss_family);
83 } 89 }
84 90
85 return s; 91 return s;
@@ -95,22 +101,43 @@ static void encode_my_addr(struct ceph_messenger *msgr)
95/* 101/*
96 * work queue for all reading and writing to/from the socket. 102 * work queue for all reading and writing to/from the socket.
97 */ 103 */
98struct workqueue_struct *ceph_msgr_wq; 104static struct workqueue_struct *ceph_msgr_wq;
105
106void _ceph_msgr_exit(void)
107{
108 if (ceph_msgr_wq) {
109 destroy_workqueue(ceph_msgr_wq);
110 ceph_msgr_wq = NULL;
111 }
112
113 BUG_ON(zero_page == NULL);
114 kunmap(zero_page);
115 page_cache_release(zero_page);
116 zero_page = NULL;
117}
99 118
100int ceph_msgr_init(void) 119int ceph_msgr_init(void)
101{ 120{
121 BUG_ON(zero_page != NULL);
122 zero_page = ZERO_PAGE(0);
123 page_cache_get(zero_page);
124
102 ceph_msgr_wq = alloc_workqueue("ceph-msgr", WQ_NON_REENTRANT, 0); 125 ceph_msgr_wq = alloc_workqueue("ceph-msgr", WQ_NON_REENTRANT, 0);
103 if (!ceph_msgr_wq) { 126 if (ceph_msgr_wq)
104 pr_err("msgr_init failed to create workqueue\n"); 127 return 0;
105 return -ENOMEM; 128
106 } 129 pr_err("msgr_init failed to create workqueue\n");
107 return 0; 130 _ceph_msgr_exit();
131
132 return -ENOMEM;
108} 133}
109EXPORT_SYMBOL(ceph_msgr_init); 134EXPORT_SYMBOL(ceph_msgr_init);
110 135
111void ceph_msgr_exit(void) 136void ceph_msgr_exit(void)
112{ 137{
113 destroy_workqueue(ceph_msgr_wq); 138 BUG_ON(ceph_msgr_wq == NULL);
139
140 _ceph_msgr_exit();
114} 141}
115EXPORT_SYMBOL(ceph_msgr_exit); 142EXPORT_SYMBOL(ceph_msgr_exit);
116 143
@@ -128,8 +155,8 @@ EXPORT_SYMBOL(ceph_msgr_flush);
128/* data available on socket, or listen socket received a connect */ 155/* data available on socket, or listen socket received a connect */
129static void ceph_data_ready(struct sock *sk, int count_unused) 156static void ceph_data_ready(struct sock *sk, int count_unused)
130{ 157{
131 struct ceph_connection *con = 158 struct ceph_connection *con = sk->sk_user_data;
132 (struct ceph_connection *)sk->sk_user_data; 159
133 if (sk->sk_state != TCP_CLOSE_WAIT) { 160 if (sk->sk_state != TCP_CLOSE_WAIT) {
134 dout("ceph_data_ready on %p state = %lu, queueing work\n", 161 dout("ceph_data_ready on %p state = %lu, queueing work\n",
135 con, con->state); 162 con, con->state);
@@ -140,26 +167,30 @@ static void ceph_data_ready(struct sock *sk, int count_unused)
140/* socket has buffer space for writing */ 167/* socket has buffer space for writing */
141static void ceph_write_space(struct sock *sk) 168static void ceph_write_space(struct sock *sk)
142{ 169{
143 struct ceph_connection *con = 170 struct ceph_connection *con = sk->sk_user_data;
144 (struct ceph_connection *)sk->sk_user_data;
145 171
146 /* only queue to workqueue if there is data we want to write. */ 172 /* only queue to workqueue if there is data we want to write,
173 * and there is sufficient space in the socket buffer to accept
174 * more data. clear SOCK_NOSPACE so that ceph_write_space()
175 * doesn't get called again until try_write() fills the socket
176 * buffer. See net/ipv4/tcp_input.c:tcp_check_space()
177 * and net/core/stream.c:sk_stream_write_space().
178 */
147 if (test_bit(WRITE_PENDING, &con->state)) { 179 if (test_bit(WRITE_PENDING, &con->state)) {
148 dout("ceph_write_space %p queueing write work\n", con); 180 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) {
149 queue_con(con); 181 dout("ceph_write_space %p queueing write work\n", con);
182 clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
183 queue_con(con);
184 }
150 } else { 185 } else {
151 dout("ceph_write_space %p nothing to write\n", con); 186 dout("ceph_write_space %p nothing to write\n", con);
152 } 187 }
153
154 /* since we have our own write_space, clear the SOCK_NOSPACE flag */
155 clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
156} 188}
157 189
158/* socket's state has changed */ 190/* socket's state has changed */
159static void ceph_state_change(struct sock *sk) 191static void ceph_state_change(struct sock *sk)
160{ 192{
161 struct ceph_connection *con = 193 struct ceph_connection *con = sk->sk_user_data;
162 (struct ceph_connection *)sk->sk_user_data;
163 194
164 dout("ceph_state_change %p state = %lu sk_state = %u\n", 195 dout("ceph_state_change %p state = %lu sk_state = %u\n",
165 con, con->state, sk->sk_state); 196 con, con->state, sk->sk_state);
@@ -184,6 +215,8 @@ static void ceph_state_change(struct sock *sk)
184 dout("ceph_state_change TCP_ESTABLISHED\n"); 215 dout("ceph_state_change TCP_ESTABLISHED\n");
185 queue_con(con); 216 queue_con(con);
186 break; 217 break;
218 default: /* Everything else is uninteresting */
219 break;
187 } 220 }
188} 221}
189 222
@@ -194,7 +227,7 @@ static void set_sock_callbacks(struct socket *sock,
194 struct ceph_connection *con) 227 struct ceph_connection *con)
195{ 228{
196 struct sock *sk = sock->sk; 229 struct sock *sk = sock->sk;
197 sk->sk_user_data = (void *)con; 230 sk->sk_user_data = con;
198 sk->sk_data_ready = ceph_data_ready; 231 sk->sk_data_ready = ceph_data_ready;
199 sk->sk_write_space = ceph_write_space; 232 sk->sk_write_space = ceph_write_space;
200 sk->sk_state_change = ceph_state_change; 233 sk->sk_state_change = ceph_state_change;
@@ -208,7 +241,7 @@ static void set_sock_callbacks(struct socket *sock,
208/* 241/*
209 * initiate connection to a remote socket. 242 * initiate connection to a remote socket.
210 */ 243 */
211static struct socket *ceph_tcp_connect(struct ceph_connection *con) 244static int ceph_tcp_connect(struct ceph_connection *con)
212{ 245{
213 struct sockaddr_storage *paddr = &con->peer_addr.in_addr; 246 struct sockaddr_storage *paddr = &con->peer_addr.in_addr;
214 struct socket *sock; 247 struct socket *sock;
@@ -218,8 +251,7 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con)
218 ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM, 251 ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM,
219 IPPROTO_TCP, &sock); 252 IPPROTO_TCP, &sock);
220 if (ret) 253 if (ret)
221 return ERR_PTR(ret); 254 return ret;
222 con->sock = sock;
223 sock->sk->sk_allocation = GFP_NOFS; 255 sock->sk->sk_allocation = GFP_NOFS;
224 256
225#ifdef CONFIG_LOCKDEP 257#ifdef CONFIG_LOCKDEP
@@ -236,19 +268,17 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con)
236 dout("connect %s EINPROGRESS sk_state = %u\n", 268 dout("connect %s EINPROGRESS sk_state = %u\n",
237 ceph_pr_addr(&con->peer_addr.in_addr), 269 ceph_pr_addr(&con->peer_addr.in_addr),
238 sock->sk->sk_state); 270 sock->sk->sk_state);
239 ret = 0; 271 } else if (ret < 0) {
240 }
241 if (ret < 0) {
242 pr_err("connect %s error %d\n", 272 pr_err("connect %s error %d\n",
243 ceph_pr_addr(&con->peer_addr.in_addr), ret); 273 ceph_pr_addr(&con->peer_addr.in_addr), ret);
244 sock_release(sock); 274 sock_release(sock);
245 con->sock = NULL;
246 con->error_msg = "connect error"; 275 con->error_msg = "connect error";
276
277 return ret;
247 } 278 }
279 con->sock = sock;
248 280
249 if (ret < 0) 281 return 0;
250 return ERR_PTR(ret);
251 return sock;
252} 282}
253 283
254static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len) 284static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len)
@@ -284,6 +314,19 @@ static int ceph_tcp_sendmsg(struct socket *sock, struct kvec *iov,
284 return r; 314 return r;
285} 315}
286 316
317static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
318 int offset, size_t size, int more)
319{
320 int flags = MSG_DONTWAIT | MSG_NOSIGNAL | (more ? MSG_MORE : MSG_EOR);
321 int ret;
322
323 ret = kernel_sendpage(sock, page, offset, size, flags);
324 if (ret == -EAGAIN)
325 ret = 0;
326
327 return ret;
328}
329
287 330
288/* 331/*
289 * Shutdown/close the socket for the given connection. 332 * Shutdown/close the socket for the given connection.
@@ -391,22 +434,23 @@ bool ceph_con_opened(struct ceph_connection *con)
391 */ 434 */
392struct ceph_connection *ceph_con_get(struct ceph_connection *con) 435struct ceph_connection *ceph_con_get(struct ceph_connection *con)
393{ 436{
394 dout("con_get %p nref = %d -> %d\n", con, 437 int nref = __atomic_add_unless(&con->nref, 1, 0);
395 atomic_read(&con->nref), atomic_read(&con->nref) + 1); 438
396 if (atomic_inc_not_zero(&con->nref)) 439 dout("con_get %p nref = %d -> %d\n", con, nref, nref + 1);
397 return con; 440
398 return NULL; 441 return nref ? con : NULL;
399} 442}
400 443
401void ceph_con_put(struct ceph_connection *con) 444void ceph_con_put(struct ceph_connection *con)
402{ 445{
403 dout("con_put %p nref = %d -> %d\n", con, 446 int nref = atomic_dec_return(&con->nref);
404 atomic_read(&con->nref), atomic_read(&con->nref) - 1); 447
405 BUG_ON(atomic_read(&con->nref) == 0); 448 BUG_ON(nref < 0);
406 if (atomic_dec_and_test(&con->nref)) { 449 if (nref == 0) {
407 BUG_ON(con->sock); 450 BUG_ON(con->sock);
408 kfree(con); 451 kfree(con);
409 } 452 }
453 dout("con_put %p nref = %d -> %d\n", con, nref + 1, nref);
410} 454}
411 455
412/* 456/*
@@ -442,14 +486,35 @@ static u32 get_global_seq(struct ceph_messenger *msgr, u32 gt)
442 return ret; 486 return ret;
443} 487}
444 488
489static void ceph_con_out_kvec_reset(struct ceph_connection *con)
490{
491 con->out_kvec_left = 0;
492 con->out_kvec_bytes = 0;
493 con->out_kvec_cur = &con->out_kvec[0];
494}
495
496static void ceph_con_out_kvec_add(struct ceph_connection *con,
497 size_t size, void *data)
498{
499 int index;
500
501 index = con->out_kvec_left;
502 BUG_ON(index >= ARRAY_SIZE(con->out_kvec));
503
504 con->out_kvec[index].iov_len = size;
505 con->out_kvec[index].iov_base = data;
506 con->out_kvec_left++;
507 con->out_kvec_bytes += size;
508}
445 509
446/* 510/*
447 * Prepare footer for currently outgoing message, and finish things 511 * Prepare footer for currently outgoing message, and finish things
448 * off. Assumes out_kvec* are already valid.. we just add on to the end. 512 * off. Assumes out_kvec* are already valid.. we just add on to the end.
449 */ 513 */
450static void prepare_write_message_footer(struct ceph_connection *con, int v) 514static void prepare_write_message_footer(struct ceph_connection *con)
451{ 515{
452 struct ceph_msg *m = con->out_msg; 516 struct ceph_msg *m = con->out_msg;
517 int v = con->out_kvec_left;
453 518
454 dout("prepare_write_message_footer %p\n", con); 519 dout("prepare_write_message_footer %p\n", con);
455 con->out_kvec_is_msg = true; 520 con->out_kvec_is_msg = true;
@@ -467,9 +532,9 @@ static void prepare_write_message_footer(struct ceph_connection *con, int v)
467static void prepare_write_message(struct ceph_connection *con) 532static void prepare_write_message(struct ceph_connection *con)
468{ 533{
469 struct ceph_msg *m; 534 struct ceph_msg *m;
470 int v = 0; 535 u32 crc;
471 536
472 con->out_kvec_bytes = 0; 537 ceph_con_out_kvec_reset(con);
473 con->out_kvec_is_msg = true; 538 con->out_kvec_is_msg = true;
474 con->out_msg_done = false; 539 con->out_msg_done = false;
475 540
@@ -477,16 +542,13 @@ static void prepare_write_message(struct ceph_connection *con)
477 * TCP packet that's a good thing. */ 542 * TCP packet that's a good thing. */
478 if (con->in_seq > con->in_seq_acked) { 543 if (con->in_seq > con->in_seq_acked) {
479 con->in_seq_acked = con->in_seq; 544 con->in_seq_acked = con->in_seq;
480 con->out_kvec[v].iov_base = &tag_ack; 545 ceph_con_out_kvec_add(con, sizeof (tag_ack), &tag_ack);
481 con->out_kvec[v++].iov_len = 1;
482 con->out_temp_ack = cpu_to_le64(con->in_seq_acked); 546 con->out_temp_ack = cpu_to_le64(con->in_seq_acked);
483 con->out_kvec[v].iov_base = &con->out_temp_ack; 547 ceph_con_out_kvec_add(con, sizeof (con->out_temp_ack),
484 con->out_kvec[v++].iov_len = sizeof(con->out_temp_ack); 548 &con->out_temp_ack);
485 con->out_kvec_bytes = 1 + sizeof(con->out_temp_ack);
486 } 549 }
487 550
488 m = list_first_entry(&con->out_queue, 551 m = list_first_entry(&con->out_queue, struct ceph_msg, list_head);
489 struct ceph_msg, list_head);
490 con->out_msg = m; 552 con->out_msg = m;
491 553
492 /* put message on sent list */ 554 /* put message on sent list */
@@ -510,30 +572,26 @@ static void prepare_write_message(struct ceph_connection *con)
510 BUG_ON(le32_to_cpu(m->hdr.front_len) != m->front.iov_len); 572 BUG_ON(le32_to_cpu(m->hdr.front_len) != m->front.iov_len);
511 573
512 /* tag + hdr + front + middle */ 574 /* tag + hdr + front + middle */
513 con->out_kvec[v].iov_base = &tag_msg; 575 ceph_con_out_kvec_add(con, sizeof (tag_msg), &tag_msg);
514 con->out_kvec[v++].iov_len = 1; 576 ceph_con_out_kvec_add(con, sizeof (m->hdr), &m->hdr);
515 con->out_kvec[v].iov_base = &m->hdr; 577 ceph_con_out_kvec_add(con, m->front.iov_len, m->front.iov_base);
516 con->out_kvec[v++].iov_len = sizeof(m->hdr); 578
517 con->out_kvec[v++] = m->front;
518 if (m->middle) 579 if (m->middle)
519 con->out_kvec[v++] = m->middle->vec; 580 ceph_con_out_kvec_add(con, m->middle->vec.iov_len,
520 con->out_kvec_left = v; 581 m->middle->vec.iov_base);
521 con->out_kvec_bytes += 1 + sizeof(m->hdr) + m->front.iov_len +
522 (m->middle ? m->middle->vec.iov_len : 0);
523 con->out_kvec_cur = con->out_kvec;
524 582
525 /* fill in crc (except data pages), footer */ 583 /* fill in crc (except data pages), footer */
526 con->out_msg->hdr.crc = 584 crc = crc32c(0, &m->hdr, offsetof(struct ceph_msg_header, crc));
527 cpu_to_le32(crc32c(0, (void *)&m->hdr, 585 con->out_msg->hdr.crc = cpu_to_le32(crc);
528 sizeof(m->hdr) - sizeof(m->hdr.crc)));
529 con->out_msg->footer.flags = CEPH_MSG_FOOTER_COMPLETE; 586 con->out_msg->footer.flags = CEPH_MSG_FOOTER_COMPLETE;
530 con->out_msg->footer.front_crc = 587
531 cpu_to_le32(crc32c(0, m->front.iov_base, m->front.iov_len)); 588 crc = crc32c(0, m->front.iov_base, m->front.iov_len);
532 if (m->middle) 589 con->out_msg->footer.front_crc = cpu_to_le32(crc);
533 con->out_msg->footer.middle_crc = 590 if (m->middle) {
534 cpu_to_le32(crc32c(0, m->middle->vec.iov_base, 591 crc = crc32c(0, m->middle->vec.iov_base,
535 m->middle->vec.iov_len)); 592 m->middle->vec.iov_len);
536 else 593 con->out_msg->footer.middle_crc = cpu_to_le32(crc);
594 } else
537 con->out_msg->footer.middle_crc = 0; 595 con->out_msg->footer.middle_crc = 0;
538 con->out_msg->footer.data_crc = 0; 596 con->out_msg->footer.data_crc = 0;
539 dout("prepare_write_message front_crc %u data_crc %u\n", 597 dout("prepare_write_message front_crc %u data_crc %u\n",
@@ -549,11 +607,11 @@ static void prepare_write_message(struct ceph_connection *con)
549 else 607 else
550 con->out_msg_pos.page_pos = 0; 608 con->out_msg_pos.page_pos = 0;
551 con->out_msg_pos.data_pos = 0; 609 con->out_msg_pos.data_pos = 0;
552 con->out_msg_pos.did_page_crc = 0; 610 con->out_msg_pos.did_page_crc = false;
553 con->out_more = 1; /* data + footer will follow */ 611 con->out_more = 1; /* data + footer will follow */
554 } else { 612 } else {
555 /* no, queue up footer too and be done */ 613 /* no, queue up footer too and be done */
556 prepare_write_message_footer(con, v); 614 prepare_write_message_footer(con);
557 } 615 }
558 616
559 set_bit(WRITE_PENDING, &con->state); 617 set_bit(WRITE_PENDING, &con->state);
@@ -568,14 +626,14 @@ static void prepare_write_ack(struct ceph_connection *con)
568 con->in_seq_acked, con->in_seq); 626 con->in_seq_acked, con->in_seq);
569 con->in_seq_acked = con->in_seq; 627 con->in_seq_acked = con->in_seq;
570 628
571 con->out_kvec[0].iov_base = &tag_ack; 629 ceph_con_out_kvec_reset(con);
572 con->out_kvec[0].iov_len = 1; 630
631 ceph_con_out_kvec_add(con, sizeof (tag_ack), &tag_ack);
632
573 con->out_temp_ack = cpu_to_le64(con->in_seq_acked); 633 con->out_temp_ack = cpu_to_le64(con->in_seq_acked);
574 con->out_kvec[1].iov_base = &con->out_temp_ack; 634 ceph_con_out_kvec_add(con, sizeof (con->out_temp_ack),
575 con->out_kvec[1].iov_len = sizeof(con->out_temp_ack); 635 &con->out_temp_ack);
576 con->out_kvec_left = 2; 636
577 con->out_kvec_bytes = 1 + sizeof(con->out_temp_ack);
578 con->out_kvec_cur = con->out_kvec;
579 con->out_more = 1; /* more will follow.. eventually.. */ 637 con->out_more = 1; /* more will follow.. eventually.. */
580 set_bit(WRITE_PENDING, &con->state); 638 set_bit(WRITE_PENDING, &con->state);
581} 639}
@@ -586,11 +644,8 @@ static void prepare_write_ack(struct ceph_connection *con)
586static void prepare_write_keepalive(struct ceph_connection *con) 644static void prepare_write_keepalive(struct ceph_connection *con)
587{ 645{
588 dout("prepare_write_keepalive %p\n", con); 646 dout("prepare_write_keepalive %p\n", con);
589 con->out_kvec[0].iov_base = &tag_keepalive; 647 ceph_con_out_kvec_reset(con);
590 con->out_kvec[0].iov_len = 1; 648 ceph_con_out_kvec_add(con, sizeof (tag_keepalive), &tag_keepalive);
591 con->out_kvec_left = 1;
592 con->out_kvec_bytes = 1;
593 con->out_kvec_cur = con->out_kvec;
594 set_bit(WRITE_PENDING, &con->state); 649 set_bit(WRITE_PENDING, &con->state);
595} 650}
596 651
@@ -619,12 +674,9 @@ static int prepare_connect_authorizer(struct ceph_connection *con)
619 con->out_connect.authorizer_protocol = cpu_to_le32(auth_protocol); 674 con->out_connect.authorizer_protocol = cpu_to_le32(auth_protocol);
620 con->out_connect.authorizer_len = cpu_to_le32(auth_len); 675 con->out_connect.authorizer_len = cpu_to_le32(auth_len);
621 676
622 if (auth_len) { 677 if (auth_len)
623 con->out_kvec[con->out_kvec_left].iov_base = auth_buf; 678 ceph_con_out_kvec_add(con, auth_len, auth_buf);
624 con->out_kvec[con->out_kvec_left].iov_len = auth_len; 679
625 con->out_kvec_left++;
626 con->out_kvec_bytes += auth_len;
627 }
628 return 0; 680 return 0;
629} 681}
630 682
@@ -634,22 +686,18 @@ static int prepare_connect_authorizer(struct ceph_connection *con)
634static void prepare_write_banner(struct ceph_messenger *msgr, 686static void prepare_write_banner(struct ceph_messenger *msgr,
635 struct ceph_connection *con) 687 struct ceph_connection *con)
636{ 688{
637 int len = strlen(CEPH_BANNER); 689 ceph_con_out_kvec_reset(con);
690 ceph_con_out_kvec_add(con, strlen(CEPH_BANNER), CEPH_BANNER);
691 ceph_con_out_kvec_add(con, sizeof (msgr->my_enc_addr),
692 &msgr->my_enc_addr);
638 693
639 con->out_kvec[0].iov_base = CEPH_BANNER;
640 con->out_kvec[0].iov_len = len;
641 con->out_kvec[1].iov_base = &msgr->my_enc_addr;
642 con->out_kvec[1].iov_len = sizeof(msgr->my_enc_addr);
643 con->out_kvec_left = 2;
644 con->out_kvec_bytes = len + sizeof(msgr->my_enc_addr);
645 con->out_kvec_cur = con->out_kvec;
646 con->out_more = 0; 694 con->out_more = 0;
647 set_bit(WRITE_PENDING, &con->state); 695 set_bit(WRITE_PENDING, &con->state);
648} 696}
649 697
650static int prepare_write_connect(struct ceph_messenger *msgr, 698static int prepare_write_connect(struct ceph_messenger *msgr,
651 struct ceph_connection *con, 699 struct ceph_connection *con,
652 int after_banner) 700 int include_banner)
653{ 701{
654 unsigned global_seq = get_global_seq(con->msgr, 0); 702 unsigned global_seq = get_global_seq(con->msgr, 0);
655 int proto; 703 int proto;
@@ -678,22 +726,18 @@ static int prepare_write_connect(struct ceph_messenger *msgr,
678 con->out_connect.protocol_version = cpu_to_le32(proto); 726 con->out_connect.protocol_version = cpu_to_le32(proto);
679 con->out_connect.flags = 0; 727 con->out_connect.flags = 0;
680 728
681 if (!after_banner) { 729 if (include_banner)
682 con->out_kvec_left = 0; 730 prepare_write_banner(msgr, con);
683 con->out_kvec_bytes = 0; 731 else
684 } 732 ceph_con_out_kvec_reset(con);
685 con->out_kvec[con->out_kvec_left].iov_base = &con->out_connect; 733 ceph_con_out_kvec_add(con, sizeof (con->out_connect), &con->out_connect);
686 con->out_kvec[con->out_kvec_left].iov_len = sizeof(con->out_connect); 734
687 con->out_kvec_left++;
688 con->out_kvec_bytes += sizeof(con->out_connect);
689 con->out_kvec_cur = con->out_kvec;
690 con->out_more = 0; 735 con->out_more = 0;
691 set_bit(WRITE_PENDING, &con->state); 736 set_bit(WRITE_PENDING, &con->state);
692 737
693 return prepare_connect_authorizer(con); 738 return prepare_connect_authorizer(con);
694} 739}
695 740
696
697/* 741/*
698 * write as much of pending kvecs to the socket as we can. 742 * write as much of pending kvecs to the socket as we can.
699 * 1 -> done 743 * 1 -> done
@@ -714,17 +758,18 @@ static int write_partial_kvec(struct ceph_connection *con)
714 con->out_kvec_bytes -= ret; 758 con->out_kvec_bytes -= ret;
715 if (con->out_kvec_bytes == 0) 759 if (con->out_kvec_bytes == 0)
716 break; /* done */ 760 break; /* done */
717 while (ret > 0) { 761
718 if (ret >= con->out_kvec_cur->iov_len) { 762 /* account for full iov entries consumed */
719 ret -= con->out_kvec_cur->iov_len; 763 while (ret >= con->out_kvec_cur->iov_len) {
720 con->out_kvec_cur++; 764 BUG_ON(!con->out_kvec_left);
721 con->out_kvec_left--; 765 ret -= con->out_kvec_cur->iov_len;
722 } else { 766 con->out_kvec_cur++;
723 con->out_kvec_cur->iov_len -= ret; 767 con->out_kvec_left--;
724 con->out_kvec_cur->iov_base += ret; 768 }
725 ret = 0; 769 /* and for a partially-consumed entry */
726 break; 770 if (ret) {
727 } 771 con->out_kvec_cur->iov_len -= ret;
772 con->out_kvec_cur->iov_base += ret;
728 } 773 }
729 } 774 }
730 con->out_kvec_left = 0; 775 con->out_kvec_left = 0;
@@ -773,7 +818,7 @@ static int write_partial_msg_pages(struct ceph_connection *con)
773 struct ceph_msg *msg = con->out_msg; 818 struct ceph_msg *msg = con->out_msg;
774 unsigned data_len = le32_to_cpu(msg->hdr.data_len); 819 unsigned data_len = le32_to_cpu(msg->hdr.data_len);
775 size_t len; 820 size_t len;
776 int crc = con->msgr->nocrc; 821 bool do_datacrc = !con->msgr->nocrc;
777 int ret; 822 int ret;
778 int total_max_write; 823 int total_max_write;
779 int in_trail = 0; 824 int in_trail = 0;
@@ -790,9 +835,8 @@ static int write_partial_msg_pages(struct ceph_connection *con)
790 835
791 while (data_len > con->out_msg_pos.data_pos) { 836 while (data_len > con->out_msg_pos.data_pos) {
792 struct page *page = NULL; 837 struct page *page = NULL;
793 void *kaddr = NULL;
794 int max_write = PAGE_SIZE; 838 int max_write = PAGE_SIZE;
795 int page_shift = 0; 839 int bio_offset = 0;
796 840
797 total_max_write = data_len - trail_len - 841 total_max_write = data_len - trail_len -
798 con->out_msg_pos.data_pos; 842 con->out_msg_pos.data_pos;
@@ -811,58 +855,47 @@ static int write_partial_msg_pages(struct ceph_connection *con)
811 855
812 page = list_first_entry(&msg->trail->head, 856 page = list_first_entry(&msg->trail->head,
813 struct page, lru); 857 struct page, lru);
814 if (crc)
815 kaddr = kmap(page);
816 max_write = PAGE_SIZE; 858 max_write = PAGE_SIZE;
817 } else if (msg->pages) { 859 } else if (msg->pages) {
818 page = msg->pages[con->out_msg_pos.page]; 860 page = msg->pages[con->out_msg_pos.page];
819 if (crc)
820 kaddr = kmap(page);
821 } else if (msg->pagelist) { 861 } else if (msg->pagelist) {
822 page = list_first_entry(&msg->pagelist->head, 862 page = list_first_entry(&msg->pagelist->head,
823 struct page, lru); 863 struct page, lru);
824 if (crc)
825 kaddr = kmap(page);
826#ifdef CONFIG_BLOCK 864#ifdef CONFIG_BLOCK
827 } else if (msg->bio) { 865 } else if (msg->bio) {
828 struct bio_vec *bv; 866 struct bio_vec *bv;
829 867
830 bv = bio_iovec_idx(msg->bio_iter, msg->bio_seg); 868 bv = bio_iovec_idx(msg->bio_iter, msg->bio_seg);
831 page = bv->bv_page; 869 page = bv->bv_page;
832 page_shift = bv->bv_offset; 870 bio_offset = bv->bv_offset;
833 if (crc)
834 kaddr = kmap(page) + page_shift;
835 max_write = bv->bv_len; 871 max_write = bv->bv_len;
836#endif 872#endif
837 } else { 873 } else {
838 page = con->msgr->zero_page; 874 page = zero_page;
839 if (crc)
840 kaddr = page_address(con->msgr->zero_page);
841 } 875 }
842 len = min_t(int, max_write - con->out_msg_pos.page_pos, 876 len = min_t(int, max_write - con->out_msg_pos.page_pos,
843 total_max_write); 877 total_max_write);
844 878
845 if (crc && !con->out_msg_pos.did_page_crc) { 879 if (do_datacrc && !con->out_msg_pos.did_page_crc) {
846 void *base = kaddr + con->out_msg_pos.page_pos; 880 void *base;
881 u32 crc;
847 u32 tmpcrc = le32_to_cpu(con->out_msg->footer.data_crc); 882 u32 tmpcrc = le32_to_cpu(con->out_msg->footer.data_crc);
883 char *kaddr;
848 884
885 kaddr = kmap(page);
849 BUG_ON(kaddr == NULL); 886 BUG_ON(kaddr == NULL);
850 con->out_msg->footer.data_crc = 887 base = kaddr + con->out_msg_pos.page_pos + bio_offset;
851 cpu_to_le32(crc32c(tmpcrc, base, len)); 888 crc = crc32c(tmpcrc, base, len);
852 con->out_msg_pos.did_page_crc = 1; 889 con->out_msg->footer.data_crc = cpu_to_le32(crc);
890 con->out_msg_pos.did_page_crc = true;
853 } 891 }
854 ret = kernel_sendpage(con->sock, page, 892 ret = ceph_tcp_sendpage(con->sock, page,
855 con->out_msg_pos.page_pos + page_shift, 893 con->out_msg_pos.page_pos + bio_offset,
856 len, 894 len, 1);
857 MSG_DONTWAIT | MSG_NOSIGNAL | 895
858 MSG_MORE); 896 if (do_datacrc)
859
860 if (crc &&
861 (msg->pages || msg->pagelist || msg->bio || in_trail))
862 kunmap(page); 897 kunmap(page);
863 898
864 if (ret == -EAGAIN)
865 ret = 0;
866 if (ret <= 0) 899 if (ret <= 0)
867 goto out; 900 goto out;
868 901
@@ -871,7 +904,7 @@ static int write_partial_msg_pages(struct ceph_connection *con)
871 if (ret == len) { 904 if (ret == len) {
872 con->out_msg_pos.page_pos = 0; 905 con->out_msg_pos.page_pos = 0;
873 con->out_msg_pos.page++; 906 con->out_msg_pos.page++;
874 con->out_msg_pos.did_page_crc = 0; 907 con->out_msg_pos.did_page_crc = false;
875 if (in_trail) 908 if (in_trail)
876 list_move_tail(&page->lru, 909 list_move_tail(&page->lru,
877 &msg->trail->head); 910 &msg->trail->head);
@@ -888,12 +921,10 @@ static int write_partial_msg_pages(struct ceph_connection *con)
888 dout("write_partial_msg_pages %p msg %p done\n", con, msg); 921 dout("write_partial_msg_pages %p msg %p done\n", con, msg);
889 922
890 /* prepare and queue up footer, too */ 923 /* prepare and queue up footer, too */
891 if (!crc) 924 if (!do_datacrc)
892 con->out_msg->footer.flags |= CEPH_MSG_FOOTER_NOCRC; 925 con->out_msg->footer.flags |= CEPH_MSG_FOOTER_NOCRC;
893 con->out_kvec_bytes = 0; 926 ceph_con_out_kvec_reset(con);
894 con->out_kvec_left = 0; 927 prepare_write_message_footer(con);
895 con->out_kvec_cur = con->out_kvec;
896 prepare_write_message_footer(con, 0);
897 ret = 1; 928 ret = 1;
898out: 929out:
899 return ret; 930 return ret;
@@ -907,12 +938,9 @@ static int write_partial_skip(struct ceph_connection *con)
907 int ret; 938 int ret;
908 939
909 while (con->out_skip > 0) { 940 while (con->out_skip > 0) {
910 struct kvec iov = { 941 size_t size = min(con->out_skip, (int) PAGE_CACHE_SIZE);
911 .iov_base = page_address(con->msgr->zero_page),
912 .iov_len = min(con->out_skip, (int)PAGE_CACHE_SIZE)
913 };
914 942
915 ret = ceph_tcp_sendmsg(con->sock, &iov, 1, iov.iov_len, 1); 943 ret = ceph_tcp_sendpage(con->sock, zero_page, 0, size, 1);
916 if (ret <= 0) 944 if (ret <= 0)
917 goto out; 945 goto out;
918 con->out_skip -= ret; 946 con->out_skip -= ret;
@@ -1085,8 +1113,8 @@ static void addr_set_port(struct sockaddr_storage *ss, int p)
1085static int ceph_pton(const char *str, size_t len, struct sockaddr_storage *ss, 1113static int ceph_pton(const char *str, size_t len, struct sockaddr_storage *ss,
1086 char delim, const char **ipend) 1114 char delim, const char **ipend)
1087{ 1115{
1088 struct sockaddr_in *in4 = (void *)ss; 1116 struct sockaddr_in *in4 = (struct sockaddr_in *) ss;
1089 struct sockaddr_in6 *in6 = (void *)ss; 1117 struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) ss;
1090 1118
1091 memset(ss, 0, sizeof(*ss)); 1119 memset(ss, 0, sizeof(*ss));
1092 1120
@@ -1512,10 +1540,9 @@ static int read_partial_message_section(struct ceph_connection *con,
1512 if (ret <= 0) 1540 if (ret <= 0)
1513 return ret; 1541 return ret;
1514 section->iov_len += ret; 1542 section->iov_len += ret;
1515 if (section->iov_len == sec_len)
1516 *crc = crc32c(0, section->iov_base,
1517 section->iov_len);
1518 } 1543 }
1544 if (section->iov_len == sec_len)
1545 *crc = crc32c(0, section->iov_base, section->iov_len);
1519 1546
1520 return 1; 1547 return 1;
1521} 1548}
@@ -1527,7 +1554,7 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con,
1527 1554
1528static int read_partial_message_pages(struct ceph_connection *con, 1555static int read_partial_message_pages(struct ceph_connection *con,
1529 struct page **pages, 1556 struct page **pages,
1530 unsigned data_len, int datacrc) 1557 unsigned data_len, bool do_datacrc)
1531{ 1558{
1532 void *p; 1559 void *p;
1533 int ret; 1560 int ret;
@@ -1540,7 +1567,7 @@ static int read_partial_message_pages(struct ceph_connection *con,
1540 p = kmap(pages[con->in_msg_pos.page]); 1567 p = kmap(pages[con->in_msg_pos.page]);
1541 ret = ceph_tcp_recvmsg(con->sock, p + con->in_msg_pos.page_pos, 1568 ret = ceph_tcp_recvmsg(con->sock, p + con->in_msg_pos.page_pos,
1542 left); 1569 left);
1543 if (ret > 0 && datacrc) 1570 if (ret > 0 && do_datacrc)
1544 con->in_data_crc = 1571 con->in_data_crc =
1545 crc32c(con->in_data_crc, 1572 crc32c(con->in_data_crc,
1546 p + con->in_msg_pos.page_pos, ret); 1573 p + con->in_msg_pos.page_pos, ret);
@@ -1560,7 +1587,7 @@ static int read_partial_message_pages(struct ceph_connection *con,
1560#ifdef CONFIG_BLOCK 1587#ifdef CONFIG_BLOCK
1561static int read_partial_message_bio(struct ceph_connection *con, 1588static int read_partial_message_bio(struct ceph_connection *con,
1562 struct bio **bio_iter, int *bio_seg, 1589 struct bio **bio_iter, int *bio_seg,
1563 unsigned data_len, int datacrc) 1590 unsigned data_len, bool do_datacrc)
1564{ 1591{
1565 struct bio_vec *bv = bio_iovec_idx(*bio_iter, *bio_seg); 1592 struct bio_vec *bv = bio_iovec_idx(*bio_iter, *bio_seg);
1566 void *p; 1593 void *p;
@@ -1576,7 +1603,7 @@ static int read_partial_message_bio(struct ceph_connection *con,
1576 1603
1577 ret = ceph_tcp_recvmsg(con->sock, p + con->in_msg_pos.page_pos, 1604 ret = ceph_tcp_recvmsg(con->sock, p + con->in_msg_pos.page_pos,
1578 left); 1605 left);
1579 if (ret > 0 && datacrc) 1606 if (ret > 0 && do_datacrc)
1580 con->in_data_crc = 1607 con->in_data_crc =
1581 crc32c(con->in_data_crc, 1608 crc32c(con->in_data_crc,
1582 p + con->in_msg_pos.page_pos, ret); 1609 p + con->in_msg_pos.page_pos, ret);
@@ -1603,9 +1630,10 @@ static int read_partial_message(struct ceph_connection *con)
1603 int ret; 1630 int ret;
1604 int to, left; 1631 int to, left;
1605 unsigned front_len, middle_len, data_len; 1632 unsigned front_len, middle_len, data_len;
1606 int datacrc = con->msgr->nocrc; 1633 bool do_datacrc = !con->msgr->nocrc;
1607 int skip; 1634 int skip;
1608 u64 seq; 1635 u64 seq;
1636 u32 crc;
1609 1637
1610 dout("read_partial_message con %p msg %p\n", con, m); 1638 dout("read_partial_message con %p msg %p\n", con, m);
1611 1639
@@ -1618,17 +1646,16 @@ static int read_partial_message(struct ceph_connection *con)
1618 if (ret <= 0) 1646 if (ret <= 0)
1619 return ret; 1647 return ret;
1620 con->in_base_pos += ret; 1648 con->in_base_pos += ret;
1621 if (con->in_base_pos == sizeof(con->in_hdr)) {
1622 u32 crc = crc32c(0, (void *)&con->in_hdr,
1623 sizeof(con->in_hdr) - sizeof(con->in_hdr.crc));
1624 if (crc != le32_to_cpu(con->in_hdr.crc)) {
1625 pr_err("read_partial_message bad hdr "
1626 " crc %u != expected %u\n",
1627 crc, con->in_hdr.crc);
1628 return -EBADMSG;
1629 }
1630 }
1631 } 1649 }
1650
1651 crc = crc32c(0, &con->in_hdr, offsetof(struct ceph_msg_header, crc));
1652 if (cpu_to_le32(crc) != con->in_hdr.crc) {
1653 pr_err("read_partial_message bad hdr "
1654 " crc %u != expected %u\n",
1655 crc, con->in_hdr.crc);
1656 return -EBADMSG;
1657 }
1658
1632 front_len = le32_to_cpu(con->in_hdr.front_len); 1659 front_len = le32_to_cpu(con->in_hdr.front_len);
1633 if (front_len > CEPH_MSG_MAX_FRONT_LEN) 1660 if (front_len > CEPH_MSG_MAX_FRONT_LEN)
1634 return -EIO; 1661 return -EIO;
@@ -1714,7 +1741,7 @@ static int read_partial_message(struct ceph_connection *con)
1714 while (con->in_msg_pos.data_pos < data_len) { 1741 while (con->in_msg_pos.data_pos < data_len) {
1715 if (m->pages) { 1742 if (m->pages) {
1716 ret = read_partial_message_pages(con, m->pages, 1743 ret = read_partial_message_pages(con, m->pages,
1717 data_len, datacrc); 1744 data_len, do_datacrc);
1718 if (ret <= 0) 1745 if (ret <= 0)
1719 return ret; 1746 return ret;
1720#ifdef CONFIG_BLOCK 1747#ifdef CONFIG_BLOCK
@@ -1722,7 +1749,7 @@ static int read_partial_message(struct ceph_connection *con)
1722 1749
1723 ret = read_partial_message_bio(con, 1750 ret = read_partial_message_bio(con,
1724 &m->bio_iter, &m->bio_seg, 1751 &m->bio_iter, &m->bio_seg,
1725 data_len, datacrc); 1752 data_len, do_datacrc);
1726 if (ret <= 0) 1753 if (ret <= 0)
1727 return ret; 1754 return ret;
1728#endif 1755#endif
@@ -1757,7 +1784,7 @@ static int read_partial_message(struct ceph_connection *con)
1757 m, con->in_middle_crc, m->footer.middle_crc); 1784 m, con->in_middle_crc, m->footer.middle_crc);
1758 return -EBADMSG; 1785 return -EBADMSG;
1759 } 1786 }
1760 if (datacrc && 1787 if (do_datacrc &&
1761 (m->footer.flags & CEPH_MSG_FOOTER_NOCRC) == 0 && 1788 (m->footer.flags & CEPH_MSG_FOOTER_NOCRC) == 0 &&
1762 con->in_data_crc != le32_to_cpu(m->footer.data_crc)) { 1789 con->in_data_crc != le32_to_cpu(m->footer.data_crc)) {
1763 pr_err("read_partial_message %p data crc %u != exp. %u\n", m, 1790 pr_err("read_partial_message %p data crc %u != exp. %u\n", m,
@@ -1819,7 +1846,6 @@ more:
1819 1846
1820 /* open the socket first? */ 1847 /* open the socket first? */
1821 if (con->sock == NULL) { 1848 if (con->sock == NULL) {
1822 prepare_write_banner(msgr, con);
1823 prepare_write_connect(msgr, con, 1); 1849 prepare_write_connect(msgr, con, 1);
1824 prepare_read_banner(con); 1850 prepare_read_banner(con);
1825 set_bit(CONNECTING, &con->state); 1851 set_bit(CONNECTING, &con->state);
@@ -1829,11 +1855,9 @@ more:
1829 con->in_tag = CEPH_MSGR_TAG_READY; 1855 con->in_tag = CEPH_MSGR_TAG_READY;
1830 dout("try_write initiating connect on %p new state %lu\n", 1856 dout("try_write initiating connect on %p new state %lu\n",
1831 con, con->state); 1857 con, con->state);
1832 con->sock = ceph_tcp_connect(con); 1858 ret = ceph_tcp_connect(con);
1833 if (IS_ERR(con->sock)) { 1859 if (ret < 0) {
1834 con->sock = NULL;
1835 con->error_msg = "connect error"; 1860 con->error_msg = "connect error";
1836 ret = -1;
1837 goto out; 1861 goto out;
1838 } 1862 }
1839 } 1863 }
@@ -1953,8 +1977,9 @@ more:
1953 * 1977 *
1954 * FIXME: there must be a better way to do this! 1978 * FIXME: there must be a better way to do this!
1955 */ 1979 */
1956 static char buf[1024]; 1980 static char buf[SKIP_BUF_SIZE];
1957 int skip = min(1024, -con->in_base_pos); 1981 int skip = min((int) sizeof (buf), -con->in_base_pos);
1982
1958 dout("skipping %d / %d bytes\n", skip, -con->in_base_pos); 1983 dout("skipping %d / %d bytes\n", skip, -con->in_base_pos);
1959 ret = ceph_tcp_recvmsg(con->sock, buf, skip); 1984 ret = ceph_tcp_recvmsg(con->sock, buf, skip);
1960 if (ret <= 0) 1985 if (ret <= 0)
@@ -2216,15 +2241,6 @@ struct ceph_messenger *ceph_messenger_create(struct ceph_entity_addr *myaddr,
2216 2241
2217 spin_lock_init(&msgr->global_seq_lock); 2242 spin_lock_init(&msgr->global_seq_lock);
2218 2243
2219 /* the zero page is needed if a request is "canceled" while the message
2220 * is being written over the socket */
2221 msgr->zero_page = __page_cache_alloc(GFP_KERNEL | __GFP_ZERO);
2222 if (!msgr->zero_page) {
2223 kfree(msgr);
2224 return ERR_PTR(-ENOMEM);
2225 }
2226 kmap(msgr->zero_page);
2227
2228 if (myaddr) 2244 if (myaddr)
2229 msgr->inst.addr = *myaddr; 2245 msgr->inst.addr = *myaddr;
2230 2246
@@ -2241,8 +2257,6 @@ EXPORT_SYMBOL(ceph_messenger_create);
2241void ceph_messenger_destroy(struct ceph_messenger *msgr) 2257void ceph_messenger_destroy(struct ceph_messenger *msgr)
2242{ 2258{
2243 dout("destroy %p\n", msgr); 2259 dout("destroy %p\n", msgr);
2244 kunmap(msgr->zero_page);
2245 __free_page(msgr->zero_page);
2246 kfree(msgr); 2260 kfree(msgr);
2247 dout("destroyed messenger %p\n", msgr); 2261 dout("destroyed messenger %p\n", msgr);
2248} 2262}
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index fd863fe76934..29ad46ec9dcf 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -283,7 +283,8 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
283 ceph_decode_32_safe(p, end, yes, bad); 283 ceph_decode_32_safe(p, end, yes, bad);
284#if BITS_PER_LONG == 32 284#if BITS_PER_LONG == 32
285 err = -EINVAL; 285 err = -EINVAL;
286 if (yes > ULONG_MAX / sizeof(struct crush_rule_step)) 286 if (yes > (ULONG_MAX - sizeof(*r))
287 / sizeof(struct crush_rule_step))
287 goto bad; 288 goto bad;
288#endif 289#endif
289 r = c->rules[i] = kmalloc(sizeof(*r) + 290 r = c->rules[i] = kmalloc(sizeof(*r) +
diff --git a/net/compat.c b/net/compat.c
index 64b4515a64e6..e055708b8ec9 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -219,8 +219,6 @@ Efault:
219 219
220int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data) 220int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
221{ 221{
222 struct compat_timeval ctv;
223 struct compat_timespec cts[3];
224 struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control; 222 struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
225 struct compat_cmsghdr cmhdr; 223 struct compat_cmsghdr cmhdr;
226 int cmlen; 224 int cmlen;
@@ -230,24 +228,28 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
230 return 0; /* XXX: return error? check spec. */ 228 return 0; /* XXX: return error? check spec. */
231 } 229 }
232 230
233 if (level == SOL_SOCKET && type == SCM_TIMESTAMP) { 231 if (!COMPAT_USE_64BIT_TIME) {
234 struct timeval *tv = (struct timeval *)data; 232 struct compat_timeval ctv;
235 ctv.tv_sec = tv->tv_sec; 233 struct compat_timespec cts[3];
236 ctv.tv_usec = tv->tv_usec; 234 if (level == SOL_SOCKET && type == SCM_TIMESTAMP) {
237 data = &ctv; 235 struct timeval *tv = (struct timeval *)data;
238 len = sizeof(ctv); 236 ctv.tv_sec = tv->tv_sec;
239 } 237 ctv.tv_usec = tv->tv_usec;
240 if (level == SOL_SOCKET && 238 data = &ctv;
241 (type == SCM_TIMESTAMPNS || type == SCM_TIMESTAMPING)) { 239 len = sizeof(ctv);
242 int count = type == SCM_TIMESTAMPNS ? 1 : 3; 240 }
243 int i; 241 if (level == SOL_SOCKET &&
244 struct timespec *ts = (struct timespec *)data; 242 (type == SCM_TIMESTAMPNS || type == SCM_TIMESTAMPING)) {
245 for (i = 0; i < count; i++) { 243 int count = type == SCM_TIMESTAMPNS ? 1 : 3;
246 cts[i].tv_sec = ts[i].tv_sec; 244 int i;
247 cts[i].tv_nsec = ts[i].tv_nsec; 245 struct timespec *ts = (struct timespec *)data;
246 for (i = 0; i < count; i++) {
247 cts[i].tv_sec = ts[i].tv_sec;
248 cts[i].tv_nsec = ts[i].tv_nsec;
249 }
250 data = &cts;
251 len = sizeof(cts[0]) * count;
248 } 252 }
249 data = &cts;
250 len = sizeof(cts[0]) * count;
251 } 253 }
252 254
253 cmlen = CMSG_COMPAT_LEN(len); 255 cmlen = CMSG_COMPAT_LEN(len);
@@ -454,11 +456,15 @@ static int compat_sock_getsockopt(struct socket *sock, int level, int optname,
454 456
455int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) 457int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
456{ 458{
457 struct compat_timeval __user *ctv = 459 struct compat_timeval __user *ctv;
458 (struct compat_timeval __user *) userstamp; 460 int err;
459 int err = -ENOENT;
460 struct timeval tv; 461 struct timeval tv;
461 462
463 if (COMPAT_USE_64BIT_TIME)
464 return sock_get_timestamp(sk, userstamp);
465
466 ctv = (struct compat_timeval __user *) userstamp;
467 err = -ENOENT;
462 if (!sock_flag(sk, SOCK_TIMESTAMP)) 468 if (!sock_flag(sk, SOCK_TIMESTAMP))
463 sock_enable_timestamp(sk, SOCK_TIMESTAMP); 469 sock_enable_timestamp(sk, SOCK_TIMESTAMP);
464 tv = ktime_to_timeval(sk->sk_stamp); 470 tv = ktime_to_timeval(sk->sk_stamp);
@@ -478,11 +484,15 @@ EXPORT_SYMBOL(compat_sock_get_timestamp);
478 484
479int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp) 485int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
480{ 486{
481 struct compat_timespec __user *ctv = 487 struct compat_timespec __user *ctv;
482 (struct compat_timespec __user *) userstamp; 488 int err;
483 int err = -ENOENT;
484 struct timespec ts; 489 struct timespec ts;
485 490
491 if (COMPAT_USE_64BIT_TIME)
492 return sock_get_timestampns (sk, userstamp);
493
494 ctv = (struct compat_timespec __user *) userstamp;
495 err = -ENOENT;
486 if (!sock_flag(sk, SOCK_TIMESTAMP)) 496 if (!sock_flag(sk, SOCK_TIMESTAMP))
487 sock_enable_timestamp(sk, SOCK_TIMESTAMP); 497 sock_enable_timestamp(sk, SOCK_TIMESTAMP);
488 ts = ktime_to_timespec(sk->sk_stamp); 498 ts = ktime_to_timespec(sk->sk_stamp);
@@ -767,6 +777,11 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
767 int datagrams; 777 int datagrams;
768 struct timespec ktspec; 778 struct timespec ktspec;
769 779
780 if (COMPAT_USE_64BIT_TIME)
781 return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
782 flags | MSG_CMSG_COMPAT,
783 (struct timespec *) timeout);
784
770 if (timeout == NULL) 785 if (timeout == NULL)
771 return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, 786 return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
772 flags | MSG_CMSG_COMPAT, NULL); 787 flags | MSG_CMSG_COMPAT, NULL);
diff --git a/net/core/datagram.c b/net/core/datagram.c
index d3cf12f62c8f..e4fbfd6e2bd4 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -37,7 +37,6 @@
37#include <linux/types.h> 37#include <linux/types.h>
38#include <linux/kernel.h> 38#include <linux/kernel.h>
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40#include <asm/system.h>
41#include <linux/mm.h> 40#include <linux/mm.h>
42#include <linux/interrupt.h> 41#include <linux/interrupt.h>
43#include <linux/errno.h> 42#include <linux/errno.h>
diff --git a/net/core/dev.c b/net/core/dev.c
index 723a4065a00e..c25d453b2803 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -73,7 +73,6 @@
73 */ 73 */
74 74
75#include <asm/uaccess.h> 75#include <asm/uaccess.h>
76#include <asm/system.h>
77#include <linux/bitops.h> 76#include <linux/bitops.h>
78#include <linux/capability.h> 77#include <linux/capability.h>
79#include <linux/cpu.h> 78#include <linux/cpu.h>
@@ -4029,54 +4028,41 @@ static int dev_ifconf(struct net *net, char __user *arg)
4029 4028
4030#ifdef CONFIG_PROC_FS 4029#ifdef CONFIG_PROC_FS
4031 4030
4032#define BUCKET_SPACE (32 - NETDEV_HASHBITS) 4031#define BUCKET_SPACE (32 - NETDEV_HASHBITS - 1)
4033
4034struct dev_iter_state {
4035 struct seq_net_private p;
4036 unsigned int pos; /* bucket << BUCKET_SPACE + offset */
4037};
4038 4032
4039#define get_bucket(x) ((x) >> BUCKET_SPACE) 4033#define get_bucket(x) ((x) >> BUCKET_SPACE)
4040#define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1)) 4034#define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1))
4041#define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o)) 4035#define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o))
4042 4036
4043static inline struct net_device *dev_from_same_bucket(struct seq_file *seq) 4037static inline struct net_device *dev_from_same_bucket(struct seq_file *seq, loff_t *pos)
4044{ 4038{
4045 struct dev_iter_state *state = seq->private;
4046 struct net *net = seq_file_net(seq); 4039 struct net *net = seq_file_net(seq);
4047 struct net_device *dev; 4040 struct net_device *dev;
4048 struct hlist_node *p; 4041 struct hlist_node *p;
4049 struct hlist_head *h; 4042 struct hlist_head *h;
4050 unsigned int count, bucket, offset; 4043 unsigned int count = 0, offset = get_offset(*pos);
4051 4044
4052 bucket = get_bucket(state->pos); 4045 h = &net->dev_name_head[get_bucket(*pos)];
4053 offset = get_offset(state->pos);
4054 h = &net->dev_name_head[bucket];
4055 count = 0;
4056 hlist_for_each_entry_rcu(dev, p, h, name_hlist) { 4046 hlist_for_each_entry_rcu(dev, p, h, name_hlist) {
4057 if (count++ == offset) { 4047 if (++count == offset)
4058 state->pos = set_bucket_offset(bucket, count);
4059 return dev; 4048 return dev;
4060 }
4061 } 4049 }
4062 4050
4063 return NULL; 4051 return NULL;
4064} 4052}
4065 4053
4066static inline struct net_device *dev_from_new_bucket(struct seq_file *seq) 4054static inline struct net_device *dev_from_bucket(struct seq_file *seq, loff_t *pos)
4067{ 4055{
4068 struct dev_iter_state *state = seq->private;
4069 struct net_device *dev; 4056 struct net_device *dev;
4070 unsigned int bucket; 4057 unsigned int bucket;
4071 4058
4072 bucket = get_bucket(state->pos);
4073 do { 4059 do {
4074 dev = dev_from_same_bucket(seq); 4060 dev = dev_from_same_bucket(seq, pos);
4075 if (dev) 4061 if (dev)
4076 return dev; 4062 return dev;
4077 4063
4078 bucket++; 4064 bucket = get_bucket(*pos) + 1;
4079 state->pos = set_bucket_offset(bucket, 0); 4065 *pos = set_bucket_offset(bucket, 1);
4080 } while (bucket < NETDEV_HASHENTRIES); 4066 } while (bucket < NETDEV_HASHENTRIES);
4081 4067
4082 return NULL; 4068 return NULL;
@@ -4089,33 +4075,20 @@ static inline struct net_device *dev_from_new_bucket(struct seq_file *seq)
4089void *dev_seq_start(struct seq_file *seq, loff_t *pos) 4075void *dev_seq_start(struct seq_file *seq, loff_t *pos)
4090 __acquires(RCU) 4076 __acquires(RCU)
4091{ 4077{
4092 struct dev_iter_state *state = seq->private;
4093
4094 rcu_read_lock(); 4078 rcu_read_lock();
4095 if (!*pos) 4079 if (!*pos)
4096 return SEQ_START_TOKEN; 4080 return SEQ_START_TOKEN;
4097 4081
4098 /* check for end of the hash */ 4082 if (get_bucket(*pos) >= NETDEV_HASHENTRIES)
4099 if (state->pos == 0 && *pos > 1)
4100 return NULL; 4083 return NULL;
4101 4084
4102 return dev_from_new_bucket(seq); 4085 return dev_from_bucket(seq, pos);
4103} 4086}
4104 4087
4105void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) 4088void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
4106{ 4089{
4107 struct net_device *dev;
4108
4109 ++*pos; 4090 ++*pos;
4110 4091 return dev_from_bucket(seq, pos);
4111 if (v == SEQ_START_TOKEN)
4112 return dev_from_new_bucket(seq);
4113
4114 dev = dev_from_same_bucket(seq);
4115 if (dev)
4116 return dev;
4117
4118 return dev_from_new_bucket(seq);
4119} 4092}
4120 4093
4121void dev_seq_stop(struct seq_file *seq, void *v) 4094void dev_seq_stop(struct seq_file *seq, void *v)
@@ -4214,13 +4187,7 @@ static const struct seq_operations dev_seq_ops = {
4214static int dev_seq_open(struct inode *inode, struct file *file) 4187static int dev_seq_open(struct inode *inode, struct file *file)
4215{ 4188{
4216 return seq_open_net(inode, file, &dev_seq_ops, 4189 return seq_open_net(inode, file, &dev_seq_ops,
4217 sizeof(struct dev_iter_state)); 4190 sizeof(struct seq_net_private));
4218}
4219
4220int dev_seq_open_ops(struct inode *inode, struct file *file,
4221 const struct seq_operations *ops)
4222{
4223 return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state));
4224} 4191}
4225 4192
4226static const struct file_operations dev_seq_fops = { 4193static const struct file_operations dev_seq_fops = {
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index 29c07fef9228..626698f0db8b 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -696,7 +696,8 @@ static const struct seq_operations dev_mc_seq_ops = {
696 696
697static int dev_mc_seq_open(struct inode *inode, struct file *file) 697static int dev_mc_seq_open(struct inode *inode, struct file *file)
698{ 698{
699 return dev_seq_open_ops(inode, file, &dev_mc_seq_ops); 699 return seq_open_net(inode, file, &dev_mc_seq_ops,
700 sizeof(struct seq_net_private));
700} 701}
701 702
702static const struct file_operations dev_mc_seq_fops = { 703static const struct file_operations dev_mc_seq_fops = {
diff --git a/net/core/filter.c b/net/core/filter.c
index 5099c4b4a53f..95d05a6012d1 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -33,15 +33,17 @@
33#include <net/sock.h> 33#include <net/sock.h>
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/timer.h> 35#include <linux/timer.h>
36#include <asm/system.h>
37#include <asm/uaccess.h> 36#include <asm/uaccess.h>
38#include <asm/unaligned.h> 37#include <asm/unaligned.h>
39#include <linux/filter.h> 38#include <linux/filter.h>
40#include <linux/reciprocal_div.h> 39#include <linux/reciprocal_div.h>
41#include <linux/ratelimit.h> 40#include <linux/ratelimit.h>
42 41
43/* No hurry in this branch */ 42/* No hurry in this branch
44static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size) 43 *
44 * Exported for the bpf jit load helper.
45 */
46void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, int k, unsigned int size)
45{ 47{
46 u8 *ptr = NULL; 48 u8 *ptr = NULL;
47 49
@@ -60,7 +62,7 @@ static inline void *load_pointer(const struct sk_buff *skb, int k,
60{ 62{
61 if (k >= 0) 63 if (k >= 0)
62 return skb_header_pointer(skb, k, size, buffer); 64 return skb_header_pointer(skb, k, size, buffer);
63 return __load_pointer(skb, k, size); 65 return bpf_internal_load_pointer_neg_helper(skb, k, size);
64} 66}
65 67
66/** 68/**
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 43b03dd71e85..d9d198aa9fed 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/system.h>
18#include <linux/bitops.h> 17#include <linux/bitops.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/types.h> 19#include <linux/types.h>
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index b76f8fa3fc64..545a969672ab 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -38,7 +38,6 @@
38#include <linux/pci.h> 38#include <linux/pci.h>
39 39
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41#include <asm/system.h>
42 41
43#include <linux/inet.h> 42#include <linux/inet.h>
44#include <linux/netdevice.h> 43#include <linux/netdevice.h>
diff --git a/net/core/scm.c b/net/core/scm.c
index ff52ad0a5150..611c5efd4cb0 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -28,7 +28,6 @@
28#include <linux/nsproxy.h> 28#include <linux/nsproxy.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30 30
31#include <asm/system.h>
32#include <asm/uaccess.h> 31#include <asm/uaccess.h>
33 32
34#include <net/protocol.h> 33#include <net/protocol.h>
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b2595adb605f..a396a6926238 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -66,7 +66,6 @@
66#include <net/xfrm.h> 66#include <net/xfrm.h>
67 67
68#include <asm/uaccess.h> 68#include <asm/uaccess.h>
69#include <asm/system.h>
70#include <trace/events/skb.h> 69#include <trace/events/skb.h>
71#include <linux/highmem.h> 70#include <linux/highmem.h>
72 71
@@ -3162,6 +3161,8 @@ static void sock_rmem_free(struct sk_buff *skb)
3162 */ 3161 */
3163int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) 3162int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
3164{ 3163{
3164 int len = skb->len;
3165
3165 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= 3166 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
3166 (unsigned)sk->sk_rcvbuf) 3167 (unsigned)sk->sk_rcvbuf)
3167 return -ENOMEM; 3168 return -ENOMEM;
@@ -3176,7 +3177,7 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
3176 3177
3177 skb_queue_tail(&sk->sk_error_queue, skb); 3178 skb_queue_tail(&sk->sk_error_queue, skb);
3178 if (!sock_flag(sk, SOCK_DEAD)) 3179 if (!sock_flag(sk, SOCK_DEAD))
3179 sk->sk_data_ready(sk, skb->len); 3180 sk->sk_data_ready(sk, len);
3180 return 0; 3181 return 0;
3181} 3182}
3182EXPORT_SYMBOL(sock_queue_err_skb); 3183EXPORT_SYMBOL(sock_queue_err_skb);
diff --git a/net/core/sock.c b/net/core/sock.c
index 9be6d0d6c533..b2e14c07d920 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -115,7 +115,6 @@
115#include <linux/memcontrol.h> 115#include <linux/memcontrol.h>
116 116
117#include <asm/uaccess.h> 117#include <asm/uaccess.h>
118#include <asm/system.h>
119 118
120#include <linux/netdevice.h> 119#include <linux/netdevice.h>
121#include <net/protocol.h> 120#include <net/protocol.h>
diff --git a/net/core/utils.c b/net/core/utils.c
index 386e263f6066..dc3c3faff2f4 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -30,7 +30,6 @@
30#include <net/net_ratelimit.h> 30#include <net/net_ratelimit.h>
31 31
32#include <asm/byteorder.h> 32#include <asm/byteorder.h>
33#include <asm/system.h>
34#include <asm/uaccess.h> 33#include <asm/uaccess.h>
35 34
36int net_msg_warn __read_mostly = 1; 35int net_msg_warn __read_mostly = 1;
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 19acd00a6382..4136987d94da 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -119,7 +119,6 @@ Version 0.0.6 2.1.110 07-aug-98 Eduardo Marcelo Serrat
119#include <net/sock.h> 119#include <net/sock.h>
120#include <net/tcp_states.h> 120#include <net/tcp_states.h>
121#include <net/flow.h> 121#include <net/flow.h>
122#include <asm/system.h>
123#include <asm/ioctls.h> 122#include <asm/ioctls.h>
124#include <linux/capability.h> 123#include <linux/capability.h>
125#include <linux/mm.h> 124#include <linux/mm.h>
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 16efcda2f060..a4aecb09d12a 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -42,7 +42,6 @@
42#include <linux/notifier.h> 42#include <linux/notifier.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <asm/uaccess.h> 44#include <asm/uaccess.h>
45#include <asm/system.h>
46#include <net/net_namespace.h> 45#include <net/net_namespace.h>
47#include <net/neighbour.h> 46#include <net/neighbour.h>
48#include <net/dst.h> 47#include <net/dst.h>
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c
index 73fa268fe2e8..f6544b2c91b0 100644
--- a/net/decnet/dn_nsp_in.c
+++ b/net/decnet/dn_nsp_in.c
@@ -60,7 +60,6 @@
60#include <linux/slab.h> 60#include <linux/slab.h>
61#include <net/sock.h> 61#include <net/sock.h>
62#include <net/tcp_states.h> 62#include <net/tcp_states.h>
63#include <asm/system.h>
64#include <linux/fcntl.h> 63#include <linux/fcntl.h>
65#include <linux/mm.h> 64#include <linux/mm.h>
66#include <linux/termios.h> 65#include <linux/termios.h>
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index bd78836a81eb..e446e85e64a6 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -52,7 +52,6 @@
52#include <linux/route.h> 52#include <linux/route.h>
53#include <linux/slab.h> 53#include <linux/slab.h>
54#include <net/sock.h> 54#include <net/sock.h>
55#include <asm/system.h>
56#include <linux/fcntl.h> 55#include <linux/fcntl.h>
57#include <linux/mm.h> 56#include <linux/mm.h>
58#include <linux/termios.h> 57#include <linux/termios.h>
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 7e717cb35ad1..71b5edcee401 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -47,7 +47,6 @@
47#include <linux/mutex.h> 47#include <linux/mutex.h>
48 48
49#include <linux/uaccess.h> 49#include <linux/uaccess.h>
50#include <asm/system.h>
51 50
52static const struct proto_ops econet_ops; 51static const struct proto_ops econet_ops;
53static struct hlist_head econet_sklist; 52static struct hlist_head econet_sklist;
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index a93af86b8474..bf10a311cf1c 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -59,7 +59,6 @@
59#include <net/ip.h> 59#include <net/ip.h>
60#include <net/dsa.h> 60#include <net/dsa.h>
61#include <asm/uaccess.h> 61#include <asm/uaccess.h>
62#include <asm/system.h>
63 62
64__setup("ether=", netdev_boot_setup); 63__setup("ether=", netdev_boot_setup);
65 64
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index fdf49fd44bb4..10e3751466b5 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -91,7 +91,6 @@
91#include <linux/slab.h> 91#include <linux/slab.h>
92 92
93#include <asm/uaccess.h> 93#include <asm/uaccess.h>
94#include <asm/system.h>
95 94
96#include <linux/inet.h> 95#include <linux/inet.h>
97#include <linux/igmp.h> 96#include <linux/igmp.h>
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 73f46d691abc..18d9b81ecb1a 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -113,7 +113,6 @@
113#include <net/ax25.h> 113#include <net/ax25.h>
114#include <net/netrom.h> 114#include <net/netrom.h>
115 115
116#include <asm/system.h>
117#include <linux/uaccess.h> 116#include <linux/uaccess.h>
118 117
119#include <linux/netfilter_arp.h> 118#include <linux/netfilter_arp.h>
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 3ffaad0ef98f..7ba2196e4377 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -27,7 +27,6 @@
27 27
28 28
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <asm/system.h>
31#include <linux/bitops.h> 30#include <linux/bitops.h>
32#include <linux/capability.h> 31#include <linux/capability.h>
33#include <linux/module.h> 32#include <linux/module.h>
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 76e72bacc217..cbe3a68507cf 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -15,7 +15,6 @@
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/system.h>
19#include <linux/bitops.h> 18#include <linux/bitops.h>
20#include <linux/capability.h> 19#include <linux/capability.h>
21#include <linux/types.h> 20#include <linux/types.h>
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 63aa48acc98a..a8bdf7405433 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/system.h>
18#include <linux/bitops.h> 17#include <linux/bitops.h>
19#include <linux/types.h> 18#include <linux/types.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index da9b9cb2282d..bce36f1a37b4 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -51,7 +51,6 @@
51#define VERSION "0.409" 51#define VERSION "0.409"
52 52
53#include <asm/uaccess.h> 53#include <asm/uaccess.h>
54#include <asm/system.h>
55#include <linux/bitops.h> 54#include <linux/bitops.h>
56#include <linux/types.h> 55#include <linux/types.h>
57#include <linux/kernel.h> 56#include <linux/kernel.h>
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 9664d353ccd8..2cb2bf845641 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -91,7 +91,6 @@
91#include <linux/errno.h> 91#include <linux/errno.h>
92#include <linux/timer.h> 92#include <linux/timer.h>
93#include <linux/init.h> 93#include <linux/init.h>
94#include <asm/system.h>
95#include <asm/uaccess.h> 94#include <asm/uaccess.h>
96#include <net/checksum.h> 95#include <net/checksum.h>
97#include <net/xfrm.h> 96#include <net/xfrm.h>
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index e9b90a8ca55a..ceaac24ecdca 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -73,7 +73,6 @@
73#include <linux/module.h> 73#include <linux/module.h>
74#include <linux/slab.h> 74#include <linux/slab.h>
75#include <asm/uaccess.h> 75#include <asm/uaccess.h>
76#include <asm/system.h>
77#include <linux/types.h> 76#include <linux/types.h>
78#include <linux/kernel.h> 77#include <linux/kernel.h>
79#include <linux/jiffies.h> 78#include <linux/jiffies.h>
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index f3f1108940f5..26eccc5bab1c 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -115,7 +115,6 @@
115 115
116#define pr_fmt(fmt) "IPv4: " fmt 116#define pr_fmt(fmt) "IPv4: " fmt
117 117
118#include <asm/system.h>
119#include <linux/module.h> 118#include <linux/module.h>
120#include <linux/types.h> 119#include <linux/types.h>
121#include <linux/kernel.h> 120#include <linux/kernel.h>
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index ff302bde8890..4910176d24ed 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -43,7 +43,6 @@
43 */ 43 */
44 44
45#include <asm/uaccess.h> 45#include <asm/uaccess.h>
46#include <asm/system.h>
47#include <linux/module.h> 46#include <linux/module.h>
48#include <linux/types.h> 47#include <linux/types.h>
49#include <linux/kernel.h> 48#include <linux/kernel.h>
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index dcf4d7fe3917..5bef604ac0fa 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -26,7 +26,6 @@
26 * 26 *
27 */ 27 */
28 28
29#include <asm/system.h>
30#include <asm/uaccess.h> 29#include <asm/uaccess.h>
31#include <linux/types.h> 30#include <linux/types.h>
32#include <linux/capability.h> 31#include <linux/capability.h>
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index ab6b36e6da15..50009c787bcd 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include <asm/system.h>
24#include <linux/uaccess.h> 23#include <linux/uaccess.h>
25#include <linux/types.h> 24#include <linux/types.h>
26#include <linux/fcntl.h> 25#include <linux/fcntl.h>
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 634aa824b17e..e4d18f2a305d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -66,7 +66,6 @@
66 66
67#include <linux/module.h> 67#include <linux/module.h>
68#include <asm/uaccess.h> 68#include <asm/uaccess.h>
69#include <asm/system.h>
70#include <linux/bitops.h> 69#include <linux/bitops.h>
71#include <linux/types.h> 70#include <linux/types.h>
72#include <linux/kernel.h> 71#include <linux/kernel.h>
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index cfd7edda0a8e..5d54ed30e821 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -860,7 +860,7 @@ wait_for_memory:
860 } 860 }
861 861
862out: 862out:
863 if (copied) 863 if (copied && !(flags & MSG_SENDPAGE_NOTLAST))
864 tcp_push(sk, flags, mss_now, tp->nonagle); 864 tcp_push(sk, flags, mss_now, tp->nonagle);
865 return copied; 865 return copied;
866 866
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index d6f5feeb3eaf..fe141052a1be 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -79,7 +79,6 @@
79 79
80#define pr_fmt(fmt) "UDP: " fmt 80#define pr_fmt(fmt) "UDP: " fmt
81 81
82#include <asm/system.h>
83#include <asm/uaccess.h> 82#include <asm/uaccess.h>
84#include <asm/ioctls.h> 83#include <asm/ioctls.h>
85#include <linux/bootmem.h> 84#include <linux/bootmem.h>
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 5605f9dca87e..8ed1b930e75f 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -60,7 +60,6 @@
60#endif 60#endif
61 61
62#include <asm/uaccess.h> 62#include <asm/uaccess.h>
63#include <asm/system.h>
64#include <linux/mroute6.h> 63#include <linux/mroute6.h>
65 64
66MODULE_AUTHOR("Cast of dozens"); 65MODULE_AUTHOR("Cast of dozens");
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 6dd59f160da4..cc079d8d4681 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -66,7 +66,6 @@
66#include <net/inet_common.h> 66#include <net/inet_common.h>
67 67
68#include <asm/uaccess.h> 68#include <asm/uaccess.h>
69#include <asm/system.h>
70 69
71/* 70/*
72 * The ICMP socket(s). This is the most convenient way to flow control 71 * The ICMP socket(s). This is the most convenient way to flow control
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index ff6ddf93f269..efc0098b59dd 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -16,7 +16,6 @@
16 * 16 *
17 */ 17 */
18 18
19#include <asm/system.h>
20#include <asm/uaccess.h> 19#include <asm/uaccess.h>
21#include <linux/types.h> 20#include <linux/types.h>
22#include <linux/sched.h> 21#include <linux/sched.h>
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 6264d8fd2a2d..7dfb89f2bae5 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2044,7 +2044,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
2044 if (!delta) 2044 if (!delta)
2045 pmc->mca_sfcount[sfmode]--; 2045 pmc->mca_sfcount[sfmode]--;
2046 for (j=0; j<i; j++) 2046 for (j=0; j<i; j++)
2047 (void) ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]); 2047 ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]);
2048 } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) { 2048 } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) {
2049 struct ip6_sf_list *psf; 2049 struct ip6_sf_list *psf;
2050 2050
diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c
index ba1a3fc39b5c..42cf1390ce9c 100644
--- a/net/irda/irlan/irlan_client.c
+++ b/net/irda/irlan/irlan_client.c
@@ -37,7 +37,6 @@
37#include <linux/bitops.h> 37#include <linux/bitops.h>
38#include <net/arp.h> 38#include <net/arp.h>
39 39
40#include <asm/system.h>
41#include <asm/byteorder.h> 40#include <asm/byteorder.h>
42 41
43#include <net/irda/irda.h> 42#include <net/irda/irda.h>
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index 579617cca125..7ac4d1becbfc 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -40,7 +40,6 @@
40#include <linux/moduleparam.h> 40#include <linux/moduleparam.h>
41#include <linux/bitops.h> 41#include <linux/bitops.h>
42 42
43#include <asm/system.h>
44#include <asm/byteorder.h> 43#include <asm/byteorder.h>
45 44
46#include <net/irda/irda.h> 45#include <net/irda/irda.h>
diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c
index 8b61cf0d8a69..32dcaac70b0c 100644
--- a/net/irda/irlan/irlan_provider.c
+++ b/net/irda/irlan/irlan_provider.c
@@ -36,7 +36,6 @@
36#include <linux/bitops.h> 36#include <linux/bitops.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38 38
39#include <asm/system.h>
40#include <asm/byteorder.h> 39#include <asm/byteorder.h>
41 40
42#include <net/irda/irda.h> 41#include <net/irda/irda.h>
diff --git a/net/irda/timer.c b/net/irda/timer.c
index f418cb2ad49c..1d552b3946fc 100644
--- a/net/irda/timer.c
+++ b/net/irda/timer.c
@@ -24,7 +24,6 @@
24 * 24 *
25 ********************************************************************/ 25 ********************************************************************/
26 26
27#include <asm/system.h>
28#include <linux/delay.h> 27#include <linux/delay.h>
29 28
30#include <net/irda/timer.h> 29#include <net/irda/timer.h>
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c
index 8d0324bac01c..ab3d35f23257 100644
--- a/net/lapb/lapb_iface.c
+++ b/net/lapb/lapb_iface.c
@@ -32,7 +32,6 @@
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <net/sock.h> 33#include <net/sock.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <asm/system.h>
36#include <linux/fcntl.h> 35#include <linux/fcntl.h>
37#include <linux/mm.h> 36#include <linux/mm.h>
38#include <linux/interrupt.h> 37#include <linux/interrupt.h>
diff --git a/net/lapb/lapb_in.c b/net/lapb/lapb_in.c
index 2ec1af5c36cc..f4e3c1accab7 100644
--- a/net/lapb/lapb_in.c
+++ b/net/lapb/lapb_in.c
@@ -30,7 +30,6 @@
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <net/sock.h> 31#include <net/sock.h>
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <asm/system.h>
34#include <linux/fcntl.h> 33#include <linux/fcntl.h>
35#include <linux/mm.h> 34#include <linux/mm.h>
36#include <linux/interrupt.h> 35#include <linux/interrupt.h>
diff --git a/net/lapb/lapb_out.c b/net/lapb/lapb_out.c
index c75a79540f9f..baab2760f651 100644
--- a/net/lapb/lapb_out.c
+++ b/net/lapb/lapb_out.c
@@ -28,7 +28,6 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <net/sock.h> 29#include <net/sock.h>
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/system.h>
32#include <linux/fcntl.h> 31#include <linux/fcntl.h>
33#include <linux/mm.h> 32#include <linux/mm.h>
34#include <linux/interrupt.h> 33#include <linux/interrupt.h>
diff --git a/net/lapb/lapb_subr.c b/net/lapb/lapb_subr.c
index 43a2a7fb327b..066225b4e824 100644
--- a/net/lapb/lapb_subr.c
+++ b/net/lapb/lapb_subr.c
@@ -27,7 +27,6 @@
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <net/sock.h> 28#include <net/sock.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <asm/system.h>
31#include <linux/fcntl.h> 30#include <linux/fcntl.h>
32#include <linux/mm.h> 31#include <linux/mm.h>
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
diff --git a/net/lapb/lapb_timer.c b/net/lapb/lapb_timer.c
index af6d14b44e2e..f8cd641dfc82 100644
--- a/net/lapb/lapb_timer.c
+++ b/net/lapb/lapb_timer.c
@@ -28,7 +28,6 @@
28#include <linux/skbuff.h> 28#include <linux/skbuff.h>
29#include <net/sock.h> 29#include <net/sock.h>
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/system.h>
32#include <linux/fcntl.h> 31#include <linux/fcntl.h>
33#include <linux/mm.h> 32#include <linux/mm.h>
34#include <linux/interrupt.h> 33#include <linux/interrupt.h>
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index cc5b7a6e7e0b..778e5916d7c3 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -15,12 +15,6 @@
15#include "rate.h" 15#include "rate.h"
16#include "debugfs.h" 16#include "debugfs.h"
17 17
18int mac80211_open_file_generic(struct inode *inode, struct file *file)
19{
20 file->private_data = inode->i_private;
21 return 0;
22}
23
24#define DEBUGFS_FORMAT_BUFFER_SIZE 100 18#define DEBUGFS_FORMAT_BUFFER_SIZE 100
25 19
26int mac80211_format_buffer(char __user *userbuf, size_t count, 20int mac80211_format_buffer(char __user *userbuf, size_t count,
@@ -50,7 +44,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
50#define DEBUGFS_READONLY_FILE_OPS(name) \ 44#define DEBUGFS_READONLY_FILE_OPS(name) \
51static const struct file_operations name## _ops = { \ 45static const struct file_operations name## _ops = { \
52 .read = name## _read, \ 46 .read = name## _read, \
53 .open = mac80211_open_file_generic, \ 47 .open = simple_open, \
54 .llseek = generic_file_llseek, \ 48 .llseek = generic_file_llseek, \
55}; 49};
56 50
@@ -93,7 +87,7 @@ static ssize_t reset_write(struct file *file, const char __user *user_buf,
93 87
94static const struct file_operations reset_ops = { 88static const struct file_operations reset_ops = {
95 .write = reset_write, 89 .write = reset_write,
96 .open = mac80211_open_file_generic, 90 .open = simple_open,
97 .llseek = noop_llseek, 91 .llseek = noop_llseek,
98}; 92};
99 93
@@ -254,7 +248,7 @@ static ssize_t stats_ ##name## _read(struct file *file, \
254 \ 248 \
255static const struct file_operations stats_ ##name## _ops = { \ 249static const struct file_operations stats_ ##name## _ops = { \
256 .read = stats_ ##name## _read, \ 250 .read = stats_ ##name## _read, \
257 .open = mac80211_open_file_generic, \ 251 .open = simple_open, \
258 .llseek = generic_file_llseek, \ 252 .llseek = generic_file_llseek, \
259}; 253};
260 254
diff --git a/net/mac80211/debugfs.h b/net/mac80211/debugfs.h
index 7c87529630f5..9be4e6d71d00 100644
--- a/net/mac80211/debugfs.h
+++ b/net/mac80211/debugfs.h
@@ -3,7 +3,6 @@
3 3
4#ifdef CONFIG_MAC80211_DEBUGFS 4#ifdef CONFIG_MAC80211_DEBUGFS
5extern void debugfs_hw_add(struct ieee80211_local *local); 5extern void debugfs_hw_add(struct ieee80211_local *local);
6extern int mac80211_open_file_generic(struct inode *inode, struct file *file);
7extern int mac80211_format_buffer(char __user *userbuf, size_t count, 6extern int mac80211_format_buffer(char __user *userbuf, size_t count,
8 loff_t *ppos, char *fmt, ...); 7 loff_t *ppos, char *fmt, ...);
9#else 8#else
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 59edcd95a58d..7932767bb482 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -30,7 +30,7 @@ static ssize_t key_##name##_read(struct file *file, \
30#define KEY_OPS(name) \ 30#define KEY_OPS(name) \
31static const struct file_operations key_ ##name## _ops = { \ 31static const struct file_operations key_ ##name## _ops = { \
32 .read = key_##name##_read, \ 32 .read = key_##name##_read, \
33 .open = mac80211_open_file_generic, \ 33 .open = simple_open, \
34 .llseek = generic_file_llseek, \ 34 .llseek = generic_file_llseek, \
35} 35}
36 36
@@ -45,7 +45,7 @@ static const struct file_operations key_ ##name## _ops = { \
45#define KEY_CONF_OPS(name) \ 45#define KEY_CONF_OPS(name) \
46static const struct file_operations key_ ##name## _ops = { \ 46static const struct file_operations key_ ##name## _ops = { \
47 .read = key_conf_##name##_read, \ 47 .read = key_conf_##name##_read, \
48 .open = mac80211_open_file_generic, \ 48 .open = simple_open, \
49 .llseek = generic_file_llseek, \ 49 .llseek = generic_file_llseek, \
50} 50}
51 51
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index a32eeda04aa3..30f99c344847 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -135,7 +135,7 @@ static ssize_t ieee80211_if_read_##name(struct file *file, \
135static const struct file_operations name##_ops = { \ 135static const struct file_operations name##_ops = { \
136 .read = ieee80211_if_read_##name, \ 136 .read = ieee80211_if_read_##name, \
137 .write = (_write), \ 137 .write = (_write), \
138 .open = mac80211_open_file_generic, \ 138 .open = simple_open, \
139 .llseek = generic_file_llseek, \ 139 .llseek = generic_file_llseek, \
140} 140}
141 141
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 6d45804d09bc..832b2da5e4cd 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -33,7 +33,7 @@ static ssize_t sta_ ##name## _read(struct file *file, \
33#define STA_OPS(name) \ 33#define STA_OPS(name) \
34static const struct file_operations sta_ ##name## _ops = { \ 34static const struct file_operations sta_ ##name## _ops = { \
35 .read = sta_##name##_read, \ 35 .read = sta_##name##_read, \
36 .open = mac80211_open_file_generic, \ 36 .open = simple_open, \
37 .llseek = generic_file_llseek, \ 37 .llseek = generic_file_llseek, \
38} 38}
39 39
@@ -41,7 +41,7 @@ static const struct file_operations sta_ ##name## _ops = { \
41static const struct file_operations sta_ ##name## _ops = { \ 41static const struct file_operations sta_ ##name## _ops = { \
42 .read = sta_##name##_read, \ 42 .read = sta_##name##_read, \
43 .write = sta_##name##_write, \ 43 .write = sta_##name##_write, \
44 .open = mac80211_open_file_generic, \ 44 .open = simple_open, \
45 .llseek = generic_file_llseek, \ 45 .llseek = generic_file_llseek, \
46} 46}
47 47
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index b4f7600a3e36..3313c117b322 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -145,7 +145,7 @@ static ssize_t rcname_read(struct file *file, char __user *userbuf,
145 145
146static const struct file_operations rcname_ops = { 146static const struct file_operations rcname_ops = {
147 .read = rcname_read, 147 .read = rcname_read,
148 .open = mac80211_open_file_generic, 148 .open = simple_open,
149 .llseek = default_llseek, 149 .llseek = default_llseek,
150}; 150};
151#endif 151#endif
diff --git a/net/netfilter/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c
index fe6cb4304d72..52856178c9d7 100644
--- a/net/netfilter/ipvs/ip_vs_app.c
+++ b/net/netfilter/ipvs/ip_vs_app.c
@@ -31,7 +31,6 @@
31#include <net/net_namespace.h> 31#include <net/net_namespace.h>
32#include <net/protocol.h> 32#include <net/protocol.h>
33#include <net/tcp.h> 33#include <net/tcp.h>
34#include <asm/system.h>
35#include <linux/stat.h> 34#include <linux/stat.h>
36#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
37#include <linux/seq_file.h> 36#include <linux/seq_file.h>
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c
index 85312939695f..f843a8833250 100644
--- a/net/netfilter/ipvs/ip_vs_proto.c
+++ b/net/netfilter/ipvs/ip_vs_proto.c
@@ -25,7 +25,6 @@
25#include <net/protocol.h> 25#include <net/protocol.h>
26#include <net/tcp.h> 26#include <net/tcp.h>
27#include <net/udp.h> 27#include <net/udp.h>
28#include <asm/system.h>
29#include <linux/stat.h> 28#include <linux/stat.h>
30#include <linux/proc_fs.h> 29#include <linux/proc_fs.h>
31 30
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index b0ab8c43abe7..6cd8e32e281c 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -735,6 +735,7 @@ __nf_conntrack_alloc(struct net *net, u16 zone,
735 735
736#ifdef CONFIG_NF_CONNTRACK_ZONES 736#ifdef CONFIG_NF_CONNTRACK_ZONES
737out_free: 737out_free:
738 atomic_dec(&net->ct.count);
738 kmem_cache_free(net->ct.nf_conntrack_cachep, ct); 739 kmem_cache_free(net->ct.nf_conntrack_cachep, ct);
739 return ERR_PTR(-ENOMEM); 740 return ERR_PTR(-ENOMEM);
740#endif 741#endif
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 4d70785b953d..e6ddde165612 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -23,7 +23,6 @@
23#include <linux/net.h> 23#include <linux/net.h>
24#include <linux/skbuff.h> 24#include <linux/skbuff.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/system.h>
27#include <net/sock.h> 26#include <net/sock.h>
28#include <net/netlink.h> 27#include <net/netlink.h>
29#include <linux/init.h> 28#include <linux/init.h>
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
index 0c8e43810ce3..59530e93fa58 100644
--- a/net/netfilter/xt_CT.c
+++ b/net/netfilter/xt_CT.c
@@ -150,6 +150,17 @@ err1:
150 return ret; 150 return ret;
151} 151}
152 152
153#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
154static void __xt_ct_tg_timeout_put(struct ctnl_timeout *timeout)
155{
156 typeof(nf_ct_timeout_put_hook) timeout_put;
157
158 timeout_put = rcu_dereference(nf_ct_timeout_put_hook);
159 if (timeout_put)
160 timeout_put(timeout);
161}
162#endif
163
153static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) 164static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
154{ 165{
155 struct xt_ct_target_info_v1 *info = par->targinfo; 166 struct xt_ct_target_info_v1 *info = par->targinfo;
@@ -158,7 +169,9 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
158 struct nf_conn *ct; 169 struct nf_conn *ct;
159 int ret = 0; 170 int ret = 0;
160 u8 proto; 171 u8 proto;
161 172#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
173 struct ctnl_timeout *timeout;
174#endif
162 if (info->flags & ~XT_CT_NOTRACK) 175 if (info->flags & ~XT_CT_NOTRACK)
163 return -EINVAL; 176 return -EINVAL;
164 177
@@ -216,7 +229,6 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
216#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 229#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
217 if (info->timeout) { 230 if (info->timeout) {
218 typeof(nf_ct_timeout_find_get_hook) timeout_find_get; 231 typeof(nf_ct_timeout_find_get_hook) timeout_find_get;
219 struct ctnl_timeout *timeout;
220 struct nf_conn_timeout *timeout_ext; 232 struct nf_conn_timeout *timeout_ext;
221 233
222 rcu_read_lock(); 234 rcu_read_lock();
@@ -245,7 +257,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
245 pr_info("Timeout policy `%s' can only be " 257 pr_info("Timeout policy `%s' can only be "
246 "used by L3 protocol number %d\n", 258 "used by L3 protocol number %d\n",
247 info->timeout, timeout->l3num); 259 info->timeout, timeout->l3num);
248 goto err4; 260 goto err5;
249 } 261 }
250 /* Make sure the timeout policy matches any existing 262 /* Make sure the timeout policy matches any existing
251 * protocol tracker, otherwise default to generic. 263 * protocol tracker, otherwise default to generic.
@@ -258,13 +270,13 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
258 "used by L4 protocol number %d\n", 270 "used by L4 protocol number %d\n",
259 info->timeout, 271 info->timeout,
260 timeout->l4proto->l4proto); 272 timeout->l4proto->l4proto);
261 goto err4; 273 goto err5;
262 } 274 }
263 timeout_ext = nf_ct_timeout_ext_add(ct, timeout, 275 timeout_ext = nf_ct_timeout_ext_add(ct, timeout,
264 GFP_KERNEL); 276 GFP_ATOMIC);
265 if (timeout_ext == NULL) { 277 if (timeout_ext == NULL) {
266 ret = -ENOMEM; 278 ret = -ENOMEM;
267 goto err4; 279 goto err5;
268 } 280 }
269 } else { 281 } else {
270 ret = -ENOENT; 282 ret = -ENOENT;
@@ -281,8 +293,12 @@ out:
281 info->ct = ct; 293 info->ct = ct;
282 return 0; 294 return 0;
283 295
296#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
297err5:
298 __xt_ct_tg_timeout_put(timeout);
284err4: 299err4:
285 rcu_read_unlock(); 300 rcu_read_unlock();
301#endif
286err3: 302err3:
287 nf_conntrack_free(ct); 303 nf_conntrack_free(ct);
288err2: 304err2:
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 32bb75324e76..faa48f70b7c9 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -829,12 +829,19 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
829 return 0; 829 return 0;
830} 830}
831 831
832int netlink_sendskb(struct sock *sk, struct sk_buff *skb) 832static int __netlink_sendskb(struct sock *sk, struct sk_buff *skb)
833{ 833{
834 int len = skb->len; 834 int len = skb->len;
835 835
836 skb_queue_tail(&sk->sk_receive_queue, skb); 836 skb_queue_tail(&sk->sk_receive_queue, skb);
837 sk->sk_data_ready(sk, len); 837 sk->sk_data_ready(sk, len);
838 return len;
839}
840
841int netlink_sendskb(struct sock *sk, struct sk_buff *skb)
842{
843 int len = __netlink_sendskb(sk, skb);
844
838 sock_put(sk); 845 sock_put(sk);
839 return len; 846 return len;
840} 847}
@@ -957,8 +964,7 @@ static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
957 if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && 964 if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf &&
958 !test_bit(0, &nlk->state)) { 965 !test_bit(0, &nlk->state)) {
959 skb_set_owner_r(skb, sk); 966 skb_set_owner_r(skb, sk);
960 skb_queue_tail(&sk->sk_receive_queue, skb); 967 __netlink_sendskb(sk, skb);
961 sk->sk_data_ready(sk, skb->len);
962 return atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1); 968 return atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1);
963 } 969 }
964 return -1; 970 return -1;
@@ -1698,10 +1704,8 @@ static int netlink_dump(struct sock *sk)
1698 1704
1699 if (sk_filter(sk, skb)) 1705 if (sk_filter(sk, skb))
1700 kfree_skb(skb); 1706 kfree_skb(skb);
1701 else { 1707 else
1702 skb_queue_tail(&sk->sk_receive_queue, skb); 1708 __netlink_sendskb(sk, skb);
1703 sk->sk_data_ready(sk, skb->len);
1704 }
1705 return 0; 1709 return 0;
1706 } 1710 }
1707 1711
@@ -1715,10 +1719,8 @@ static int netlink_dump(struct sock *sk)
1715 1719
1716 if (sk_filter(sk, skb)) 1720 if (sk_filter(sk, skb))
1717 kfree_skb(skb); 1721 kfree_skb(skb);
1718 else { 1722 else
1719 skb_queue_tail(&sk->sk_receive_queue, skb); 1723 __netlink_sendskb(sk, skb);
1720 sk->sk_data_ready(sk, skb->len);
1721 }
1722 1724
1723 if (cb->done) 1725 if (cb->done)
1724 cb->done(cb); 1726 cb->done(cb);
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 7dab229bfbcc..06592d8b4a2b 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -31,7 +31,6 @@
31#include <net/net_namespace.h> 31#include <net/net_namespace.h>
32#include <net/sock.h> 32#include <net/sock.h>
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34#include <asm/system.h>
35#include <linux/fcntl.h> 34#include <linux/fcntl.h>
36#include <linux/termios.h> /* For TIOCINQ/OUTQ */ 35#include <linux/termios.h> /* For TIOCINQ/OUTQ */
37#include <linux/mm.h> 36#include <linux/mm.h>
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 64e6dde9749d..1c51d7a58f0b 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -21,7 +21,6 @@
21#include <linux/if_ether.h> /* For the statistics structure. */ 21#include <linux/if_ether.h> /* For the statistics structure. */
22#include <linux/slab.h> 22#include <linux/slab.h>
23 23
24#include <asm/system.h>
25#include <asm/uaccess.h> 24#include <asm/uaccess.h>
26#include <asm/io.h> 25#include <asm/io.h>
27 26
diff --git a/net/netrom/nr_in.c b/net/netrom/nr_in.c
index 6d4ef6d65b3d..c3073a2ef634 100644
--- a/net/netrom/nr_in.c
+++ b/net/netrom/nr_in.c
@@ -24,7 +24,6 @@
24#include <net/sock.h> 24#include <net/sock.h>
25#include <net/tcp_states.h> 25#include <net/tcp_states.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/system.h>
28#include <linux/fcntl.h> 27#include <linux/fcntl.h>
29#include <linux/mm.h> 28#include <linux/mm.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
diff --git a/net/netrom/nr_out.c b/net/netrom/nr_out.c
index 607fddb4fdbb..0b4bcb2bf38f 100644
--- a/net/netrom/nr_out.c
+++ b/net/netrom/nr_out.c
@@ -23,7 +23,6 @@
23#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <net/sock.h> 24#include <net/sock.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/system.h>
27#include <linux/fcntl.h> 26#include <linux/fcntl.h>
28#include <linux/mm.h> 27#include <linux/mm.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index 2cf330162d7e..70ffff76a967 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -26,7 +26,6 @@
26#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27#include <net/sock.h> 27#include <net/sock.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/system.h>
30#include <linux/fcntl.h> 29#include <linux/fcntl.h>
31#include <linux/termios.h> /* For TIOCINQ/OUTQ */ 30#include <linux/termios.h> /* For TIOCINQ/OUTQ */
32#include <linux/mm.h> 31#include <linux/mm.h>
diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c
index 6a947ae50dbd..ca40e2298f5a 100644
--- a/net/netrom/nr_subr.c
+++ b/net/netrom/nr_subr.c
@@ -23,7 +23,6 @@
23#include <net/sock.h> 23#include <net/sock.h>
24#include <net/tcp_states.h> 24#include <net/tcp_states.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/system.h>
27#include <linux/fcntl.h> 26#include <linux/fcntl.h>
28#include <linux/mm.h> 27#include <linux/mm.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c
index 1cb98e88f5e1..ff2c1b142f57 100644
--- a/net/netrom/nr_timer.c
+++ b/net/netrom/nr_timer.c
@@ -24,7 +24,6 @@
24#include <net/sock.h> 24#include <net/sock.h>
25#include <net/tcp_states.h> 25#include <net/tcp_states.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/system.h>
28#include <linux/fcntl.h> 27#include <linux/fcntl.h>
29#include <linux/mm.h> 28#include <linux/mm.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index f5ca1257debf..f86de29979ef 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -38,7 +38,6 @@
38#include <linux/udp.h> 38#include <linux/udp.h>
39#include <linux/ethtool.h> 39#include <linux/ethtool.h>
40#include <linux/wait.h> 40#include <linux/wait.h>
41#include <asm/system.h>
42#include <asm/div64.h> 41#include <asm/div64.h>
43#include <linux/highmem.h> 42#include <linux/highmem.h>
44#include <linux/netfilter_bridge.h> 43#include <linux/netfilter_bridge.h>
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index ae2d484416dd..4f2c0df79563 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -73,7 +73,6 @@
73#include <net/sock.h> 73#include <net/sock.h>
74#include <linux/errno.h> 74#include <linux/errno.h>
75#include <linux/timer.h> 75#include <linux/timer.h>
76#include <asm/system.h>
77#include <asm/uaccess.h> 76#include <asm/uaccess.h>
78#include <asm/ioctls.h> 77#include <asm/ioctls.h>
79#include <asm/page.h> 78#include <asm/page.h>
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 9f60008740e3..9726fe684ab8 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -1130,6 +1130,9 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk,
1130 int flags = msg->msg_flags; 1130 int flags = msg->msg_flags;
1131 int err, done; 1131 int err, done;
1132 1132
1133 if (len > USHRT_MAX)
1134 return -EMSGSIZE;
1135
1133 if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL| 1136 if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|
1134 MSG_CMSG_COMPAT)) || 1137 MSG_CMSG_COMPAT)) ||
1135 !(msg->msg_flags & MSG_EOR)) 1138 !(msg->msg_flags & MSG_EOR))
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index f9ea925ad9cb..c4719ce604c2 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -34,7 +34,6 @@
34#include <linux/if_arp.h> 34#include <linux/if_arp.h>
35#include <linux/skbuff.h> 35#include <linux/skbuff.h>
36#include <net/sock.h> 36#include <net/sock.h>
37#include <asm/system.h>
38#include <asm/uaccess.h> 37#include <asm/uaccess.h>
39#include <linux/fcntl.h> 38#include <linux/fcntl.h>
40#include <linux/termios.h> 39#include <linux/termios.h>
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c
index 2679507ad333..906cc05bba63 100644
--- a/net/rose/rose_dev.c
+++ b/net/rose/rose_dev.c
@@ -21,7 +21,6 @@
21#include <linux/if_ether.h> 21#include <linux/if_ether.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23 23
24#include <asm/system.h>
25#include <asm/io.h> 24#include <asm/io.h>
26 25
27#include <linux/inet.h> 26#include <linux/inet.h>
diff --git a/net/rose/rose_in.c b/net/rose/rose_in.c
index 7f7fcb46b4fa..79c4abcfa6b4 100644
--- a/net/rose/rose_in.c
+++ b/net/rose/rose_in.c
@@ -26,7 +26,6 @@
26#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27#include <net/sock.h> 27#include <net/sock.h>
28#include <net/tcp_states.h> 28#include <net/tcp_states.h>
29#include <asm/system.h>
30#include <linux/fcntl.h> 29#include <linux/fcntl.h>
31#include <linux/mm.h> 30#include <linux/mm.h>
32#include <linux/interrupt.h> 31#include <linux/interrupt.h>
diff --git a/net/rose/rose_link.c b/net/rose/rose_link.c
index 7a02bd1cc5a0..bc5514211b0c 100644
--- a/net/rose/rose_link.c
+++ b/net/rose/rose_link.c
@@ -22,7 +22,6 @@
22#include <linux/netdevice.h> 22#include <linux/netdevice.h>
23#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <net/sock.h> 24#include <net/sock.h>
25#include <asm/system.h>
26#include <linux/fcntl.h> 25#include <linux/fcntl.h>
27#include <linux/mm.h> 26#include <linux/mm.h>
28#include <linux/interrupt.h> 27#include <linux/interrupt.h>
diff --git a/net/rose/rose_out.c b/net/rose/rose_out.c
index 4ebf33afbe47..9ad98b524646 100644
--- a/net/rose/rose_out.c
+++ b/net/rose/rose_out.c
@@ -21,7 +21,6 @@
21#include <linux/netdevice.h> 21#include <linux/netdevice.h>
22#include <linux/skbuff.h> 22#include <linux/skbuff.h>
23#include <net/sock.h> 23#include <net/sock.h>
24#include <asm/system.h>
25#include <linux/fcntl.h> 24#include <linux/fcntl.h>
26#include <linux/mm.h> 25#include <linux/mm.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index cd9b7ee60f3e..40148932c8a4 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -25,7 +25,6 @@
25#include <linux/skbuff.h> 25#include <linux/skbuff.h>
26#include <net/sock.h> 26#include <net/sock.h>
27#include <net/tcp_states.h> 27#include <net/tcp_states.h>
28#include <asm/system.h>
29#include <asm/uaccess.h> 28#include <asm/uaccess.h>
30#include <linux/fcntl.h> 29#include <linux/fcntl.h>
31#include <linux/termios.h> /* For TIOCINQ/OUTQ */ 30#include <linux/termios.h> /* For TIOCINQ/OUTQ */
diff --git a/net/rose/rose_subr.c b/net/rose/rose_subr.c
index f6c71caa94b9..47f1fdb346b0 100644
--- a/net/rose/rose_subr.c
+++ b/net/rose/rose_subr.c
@@ -22,7 +22,6 @@
22#include <linux/skbuff.h> 22#include <linux/skbuff.h>
23#include <net/sock.h> 23#include <net/sock.h>
24#include <net/tcp_states.h> 24#include <net/tcp_states.h>
25#include <asm/system.h>
26#include <linux/fcntl.h> 25#include <linux/fcntl.h>
27#include <linux/mm.h> 26#include <linux/mm.h>
28#include <linux/interrupt.h> 27#include <linux/interrupt.h>
diff --git a/net/rose/rose_timer.c b/net/rose/rose_timer.c
index b6c8f38cc26c..bc5469d6d9cb 100644
--- a/net/rose/rose_timer.c
+++ b/net/rose/rose_timer.c
@@ -23,7 +23,6 @@
23#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <net/sock.h> 24#include <net/sock.h>
25#include <net/tcp_states.h> 25#include <net/tcp_states.h>
26#include <asm/system.h>
27#include <linux/fcntl.h> 26#include <linux/fcntl.h>
28#include <linux/mm.h> 27#include <linux/mm.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 06b42b7f5a02..92ba71dfe080 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4133,9 +4133,10 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
4133static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, 4133static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
4134 int __user *optlen) 4134 int __user *optlen)
4135{ 4135{
4136 if (len < sizeof(struct sctp_event_subscribe)) 4136 if (len <= 0)
4137 return -EINVAL; 4137 return -EINVAL;
4138 len = sizeof(struct sctp_event_subscribe); 4138 if (len > sizeof(struct sctp_event_subscribe))
4139 len = sizeof(struct sctp_event_subscribe);
4139 if (put_user(len, optlen)) 4140 if (put_user(len, optlen))
4140 return -EFAULT; 4141 return -EFAULT;
4141 if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len)) 4142 if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len))
diff --git a/net/socket.c b/net/socket.c
index 12a48d846223..851edcd6b098 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -811,9 +811,9 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
811 811
812 sock = file->private_data; 812 sock = file->private_data;
813 813
814 flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT; 814 flags = (file->f_flags & O_NONBLOCK) ? MSG_DONTWAIT : 0;
815 if (more) 815 /* more is a combination of MSG_MORE and MSG_SENDPAGE_NOTLAST */
816 flags |= MSG_MORE; 816 flags |= more;
817 817
818 return kernel_sendpage(sock, page, offset, size, flags); 818 return kernel_sendpage(sock, page, offset, size, flags);
819} 819}
@@ -2592,7 +2592,7 @@ void socket_seq_show(struct seq_file *seq)
2592 2592
2593#ifdef CONFIG_COMPAT 2593#ifdef CONFIG_COMPAT
2594static int do_siocgstamp(struct net *net, struct socket *sock, 2594static int do_siocgstamp(struct net *net, struct socket *sock,
2595 unsigned int cmd, struct compat_timeval __user *up) 2595 unsigned int cmd, void __user *up)
2596{ 2596{
2597 mm_segment_t old_fs = get_fs(); 2597 mm_segment_t old_fs = get_fs();
2598 struct timeval ktv; 2598 struct timeval ktv;
@@ -2601,15 +2601,14 @@ static int do_siocgstamp(struct net *net, struct socket *sock,
2601 set_fs(KERNEL_DS); 2601 set_fs(KERNEL_DS);
2602 err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv); 2602 err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv);
2603 set_fs(old_fs); 2603 set_fs(old_fs);
2604 if (!err) { 2604 if (!err)
2605 err = put_user(ktv.tv_sec, &up->tv_sec); 2605 err = compat_put_timeval(up, &ktv);
2606 err |= __put_user(ktv.tv_usec, &up->tv_usec); 2606
2607 }
2608 return err; 2607 return err;
2609} 2608}
2610 2609
2611static int do_siocgstampns(struct net *net, struct socket *sock, 2610static int do_siocgstampns(struct net *net, struct socket *sock,
2612 unsigned int cmd, struct compat_timespec __user *up) 2611 unsigned int cmd, void __user *up)
2613{ 2612{
2614 mm_segment_t old_fs = get_fs(); 2613 mm_segment_t old_fs = get_fs();
2615 struct timespec kts; 2614 struct timespec kts;
@@ -2618,10 +2617,9 @@ static int do_siocgstampns(struct net *net, struct socket *sock,
2618 set_fs(KERNEL_DS); 2617 set_fs(KERNEL_DS);
2619 err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts); 2618 err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts);
2620 set_fs(old_fs); 2619 set_fs(old_fs);
2621 if (!err) { 2620 if (!err)
2622 err = put_user(kts.tv_sec, &up->tv_sec); 2621 err = compat_put_timespec(up, &kts);
2623 err |= __put_user(kts.tv_nsec, &up->tv_nsec); 2622
2624 }
2625 return err; 2623 return err;
2626} 2624}
2627 2625
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index f21ece088764..de0b0f39d9d8 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -830,6 +830,8 @@ static ssize_t cache_do_downcall(char *kaddr, const char __user *buf,
830{ 830{
831 ssize_t ret; 831 ssize_t ret;
832 832
833 if (count == 0)
834 return -EINVAL;
833 if (copy_from_user(kaddr, buf, count)) 835 if (copy_from_user(kaddr, buf, count))
834 return -EFAULT; 836 return -EFAULT;
835 kaddr[count] = '\0'; 837 kaddr[count] = '\0';
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 7a4cb5fdc212..67972462a543 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -17,7 +17,6 @@
17 * Copyright (C) 1995,1996 Olaf Kirch <okir@monad.swb.de> 17 * Copyright (C) 1995,1996 Olaf Kirch <okir@monad.swb.de>
18 */ 18 */
19 19
20#include <asm/system.h>
21 20
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/types.h> 22#include <linux/types.h>
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index c84c0e0c41cb..0af37fc46818 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1014,6 +1014,7 @@ enum {
1014 RPCAUTH_statd, 1014 RPCAUTH_statd,
1015 RPCAUTH_nfsd4_cb, 1015 RPCAUTH_nfsd4_cb,
1016 RPCAUTH_cache, 1016 RPCAUTH_cache,
1017 RPCAUTH_nfsd,
1017 RPCAUTH_RootEOF 1018 RPCAUTH_RootEOF
1018}; 1019};
1019 1020
@@ -1046,6 +1047,10 @@ static const struct rpc_filelist files[] = {
1046 .name = "cache", 1047 .name = "cache",
1047 .mode = S_IFDIR | S_IRUGO | S_IXUGO, 1048 .mode = S_IFDIR | S_IRUGO | S_IXUGO,
1048 }, 1049 },
1050 [RPCAUTH_nfsd] = {
1051 .name = "nfsd",
1052 .mode = S_IFDIR | S_IRUGO | S_IXUGO,
1053 },
1049}; 1054};
1050 1055
1051/* 1056/*
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 207a74696c9f..78ac39fd9fe7 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -734,7 +734,7 @@ void rpcb_getport_async(struct rpc_task *task)
734 map->r_vers = clnt->cl_vers; 734 map->r_vers = clnt->cl_vers;
735 map->r_prot = xprt->prot; 735 map->r_prot = xprt->prot;
736 map->r_port = 0; 736 map->r_port = 0;
737 map->r_xprt = xprt_get(xprt); 737 map->r_xprt = xprt;
738 map->r_status = -EIO; 738 map->r_status = -EIO;
739 739
740 switch (bind_version) { 740 switch (bind_version) {
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index bcd574f2ac56..521d8f7dc833 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -507,7 +507,7 @@ static int unix_gid_parse(struct cache_detail *cd,
507 time_t expiry; 507 time_t expiry;
508 struct unix_gid ug, *ugp; 508 struct unix_gid ug, *ugp;
509 509
510 if (mlen <= 0 || mesg[mlen-1] != '\n') 510 if (mesg[mlen - 1] != '\n')
511 return -EINVAL; 511 return -EINVAL;
512 mesg[mlen-1] = 0; 512 mesg[mlen-1] = 0;
513 513
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 40ae884db865..824d32fb3121 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1381,8 +1381,6 @@ void svc_sock_update_bufs(struct svc_serv *serv)
1381 spin_lock_bh(&serv->sv_lock); 1381 spin_lock_bh(&serv->sv_lock);
1382 list_for_each_entry(svsk, &serv->sv_permsocks, sk_xprt.xpt_list) 1382 list_for_each_entry(svsk, &serv->sv_permsocks, sk_xprt.xpt_list)
1383 set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags); 1383 set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags);
1384 list_for_each_entry(svsk, &serv->sv_tempsocks, sk_xprt.xpt_list)
1385 set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags);
1386 spin_unlock_bh(&serv->sv_lock); 1384 spin_unlock_bh(&serv->sv_lock);
1387} 1385}
1388EXPORT_SYMBOL_GPL(svc_sock_update_bufs); 1386EXPORT_SYMBOL_GPL(svc_sock_update_bufs);
diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c
index 09af4fab1a45..8343737e85f4 100644
--- a/net/sunrpc/xprtrdma/svc_rdma.c
+++ b/net/sunrpc/xprtrdma/svc_rdma.c
@@ -47,6 +47,7 @@
47#include <linux/sunrpc/clnt.h> 47#include <linux/sunrpc/clnt.h>
48#include <linux/sunrpc/sched.h> 48#include <linux/sunrpc/sched.h>
49#include <linux/sunrpc/svc_rdma.h> 49#include <linux/sunrpc/svc_rdma.h>
50#include "xprt_rdma.h"
50 51
51#define RPCDBG_FACILITY RPCDBG_SVCXPRT 52#define RPCDBG_FACILITY RPCDBG_SVCXPRT
52 53
diff --git a/net/sunrpc/xprtrdma/svc_rdma_marshal.c b/net/sunrpc/xprtrdma/svc_rdma_marshal.c
index 9530ef2d40dc..8d2edddf48cf 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_marshal.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_marshal.c
@@ -60,21 +60,11 @@ static u32 *decode_read_list(u32 *va, u32 *vaend)
60 struct rpcrdma_read_chunk *ch = (struct rpcrdma_read_chunk *)va; 60 struct rpcrdma_read_chunk *ch = (struct rpcrdma_read_chunk *)va;
61 61
62 while (ch->rc_discrim != xdr_zero) { 62 while (ch->rc_discrim != xdr_zero) {
63 u64 ch_offset;
64
65 if (((unsigned long)ch + sizeof(struct rpcrdma_read_chunk)) > 63 if (((unsigned long)ch + sizeof(struct rpcrdma_read_chunk)) >
66 (unsigned long)vaend) { 64 (unsigned long)vaend) {
67 dprintk("svcrdma: vaend=%p, ch=%p\n", vaend, ch); 65 dprintk("svcrdma: vaend=%p, ch=%p\n", vaend, ch);
68 return NULL; 66 return NULL;
69 } 67 }
70
71 ch->rc_discrim = ntohl(ch->rc_discrim);
72 ch->rc_position = ntohl(ch->rc_position);
73 ch->rc_target.rs_handle = ntohl(ch->rc_target.rs_handle);
74 ch->rc_target.rs_length = ntohl(ch->rc_target.rs_length);
75 va = (u32 *)&ch->rc_target.rs_offset;
76 xdr_decode_hyper(va, &ch_offset);
77 put_unaligned(ch_offset, (u64 *)va);
78 ch++; 68 ch++;
79 } 69 }
80 return (u32 *)&ch->rc_position; 70 return (u32 *)&ch->rc_position;
@@ -91,7 +81,7 @@ void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *ch,
91 *byte_count = 0; 81 *byte_count = 0;
92 *ch_count = 0; 82 *ch_count = 0;
93 for (; ch->rc_discrim != 0; ch++) { 83 for (; ch->rc_discrim != 0; ch++) {
94 *byte_count = *byte_count + ch->rc_target.rs_length; 84 *byte_count = *byte_count + ntohl(ch->rc_target.rs_length);
95 *ch_count = *ch_count + 1; 85 *ch_count = *ch_count + 1;
96 } 86 }
97} 87}
@@ -108,7 +98,8 @@ void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *ch,
108 */ 98 */
109static u32 *decode_write_list(u32 *va, u32 *vaend) 99static u32 *decode_write_list(u32 *va, u32 *vaend)
110{ 100{
111 int ch_no; 101 int nchunks;
102
112 struct rpcrdma_write_array *ary = 103 struct rpcrdma_write_array *ary =
113 (struct rpcrdma_write_array *)va; 104 (struct rpcrdma_write_array *)va;
114 105
@@ -121,37 +112,24 @@ static u32 *decode_write_list(u32 *va, u32 *vaend)
121 dprintk("svcrdma: ary=%p, vaend=%p\n", ary, vaend); 112 dprintk("svcrdma: ary=%p, vaend=%p\n", ary, vaend);
122 return NULL; 113 return NULL;
123 } 114 }
124 ary->wc_discrim = ntohl(ary->wc_discrim); 115 nchunks = ntohl(ary->wc_nchunks);
125 ary->wc_nchunks = ntohl(ary->wc_nchunks);
126 if (((unsigned long)&ary->wc_array[0] + 116 if (((unsigned long)&ary->wc_array[0] +
127 (sizeof(struct rpcrdma_write_chunk) * ary->wc_nchunks)) > 117 (sizeof(struct rpcrdma_write_chunk) * nchunks)) >
128 (unsigned long)vaend) { 118 (unsigned long)vaend) {
129 dprintk("svcrdma: ary=%p, wc_nchunks=%d, vaend=%p\n", 119 dprintk("svcrdma: ary=%p, wc_nchunks=%d, vaend=%p\n",
130 ary, ary->wc_nchunks, vaend); 120 ary, nchunks, vaend);
131 return NULL; 121 return NULL;
132 } 122 }
133 for (ch_no = 0; ch_no < ary->wc_nchunks; ch_no++) {
134 u64 ch_offset;
135
136 ary->wc_array[ch_no].wc_target.rs_handle =
137 ntohl(ary->wc_array[ch_no].wc_target.rs_handle);
138 ary->wc_array[ch_no].wc_target.rs_length =
139 ntohl(ary->wc_array[ch_no].wc_target.rs_length);
140 va = (u32 *)&ary->wc_array[ch_no].wc_target.rs_offset;
141 xdr_decode_hyper(va, &ch_offset);
142 put_unaligned(ch_offset, (u64 *)va);
143 }
144
145 /* 123 /*
146 * rs_length is the 2nd 4B field in wc_target and taking its 124 * rs_length is the 2nd 4B field in wc_target and taking its
147 * address skips the list terminator 125 * address skips the list terminator
148 */ 126 */
149 return (u32 *)&ary->wc_array[ch_no].wc_target.rs_length; 127 return (u32 *)&ary->wc_array[nchunks].wc_target.rs_length;
150} 128}
151 129
152static u32 *decode_reply_array(u32 *va, u32 *vaend) 130static u32 *decode_reply_array(u32 *va, u32 *vaend)
153{ 131{
154 int ch_no; 132 int nchunks;
155 struct rpcrdma_write_array *ary = 133 struct rpcrdma_write_array *ary =
156 (struct rpcrdma_write_array *)va; 134 (struct rpcrdma_write_array *)va;
157 135
@@ -164,28 +142,15 @@ static u32 *decode_reply_array(u32 *va, u32 *vaend)
164 dprintk("svcrdma: ary=%p, vaend=%p\n", ary, vaend); 142 dprintk("svcrdma: ary=%p, vaend=%p\n", ary, vaend);
165 return NULL; 143 return NULL;
166 } 144 }
167 ary->wc_discrim = ntohl(ary->wc_discrim); 145 nchunks = ntohl(ary->wc_nchunks);
168 ary->wc_nchunks = ntohl(ary->wc_nchunks);
169 if (((unsigned long)&ary->wc_array[0] + 146 if (((unsigned long)&ary->wc_array[0] +
170 (sizeof(struct rpcrdma_write_chunk) * ary->wc_nchunks)) > 147 (sizeof(struct rpcrdma_write_chunk) * nchunks)) >
171 (unsigned long)vaend) { 148 (unsigned long)vaend) {
172 dprintk("svcrdma: ary=%p, wc_nchunks=%d, vaend=%p\n", 149 dprintk("svcrdma: ary=%p, wc_nchunks=%d, vaend=%p\n",
173 ary, ary->wc_nchunks, vaend); 150 ary, nchunks, vaend);
174 return NULL; 151 return NULL;
175 } 152 }
176 for (ch_no = 0; ch_no < ary->wc_nchunks; ch_no++) { 153 return (u32 *)&ary->wc_array[nchunks];
177 u64 ch_offset;
178
179 ary->wc_array[ch_no].wc_target.rs_handle =
180 ntohl(ary->wc_array[ch_no].wc_target.rs_handle);
181 ary->wc_array[ch_no].wc_target.rs_length =
182 ntohl(ary->wc_array[ch_no].wc_target.rs_length);
183 va = (u32 *)&ary->wc_array[ch_no].wc_target.rs_offset;
184 xdr_decode_hyper(va, &ch_offset);
185 put_unaligned(ch_offset, (u64 *)va);
186 }
187
188 return (u32 *)&ary->wc_array[ch_no];
189} 154}
190 155
191int svc_rdma_xdr_decode_req(struct rpcrdma_msg **rdma_req, 156int svc_rdma_xdr_decode_req(struct rpcrdma_msg **rdma_req,
@@ -386,13 +351,14 @@ void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *ary,
386 351
387void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *ary, 352void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *ary,
388 int chunk_no, 353 int chunk_no,
389 u32 rs_handle, u64 rs_offset, 354 __be32 rs_handle,
355 __be64 rs_offset,
390 u32 write_len) 356 u32 write_len)
391{ 357{
392 struct rpcrdma_segment *seg = &ary->wc_array[chunk_no].wc_target; 358 struct rpcrdma_segment *seg = &ary->wc_array[chunk_no].wc_target;
393 seg->rs_handle = htonl(rs_handle); 359 seg->rs_handle = rs_handle;
360 seg->rs_offset = rs_offset;
394 seg->rs_length = htonl(write_len); 361 seg->rs_length = htonl(write_len);
395 xdr_encode_hyper((u32 *) &seg->rs_offset, rs_offset);
396} 362}
397 363
398void svc_rdma_xdr_encode_reply_header(struct svcxprt_rdma *xprt, 364void svc_rdma_xdr_encode_reply_header(struct svcxprt_rdma *xprt,
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index df67211c4baf..41cb63b623df 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -147,7 +147,7 @@ static int map_read_chunks(struct svcxprt_rdma *xprt,
147 page_off = 0; 147 page_off = 0;
148 ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0]; 148 ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0];
149 ch_no = 0; 149 ch_no = 0;
150 ch_bytes = ch->rc_target.rs_length; 150 ch_bytes = ntohl(ch->rc_target.rs_length);
151 head->arg.head[0] = rqstp->rq_arg.head[0]; 151 head->arg.head[0] = rqstp->rq_arg.head[0];
152 head->arg.tail[0] = rqstp->rq_arg.tail[0]; 152 head->arg.tail[0] = rqstp->rq_arg.tail[0];
153 head->arg.pages = &head->pages[head->count]; 153 head->arg.pages = &head->pages[head->count];
@@ -183,7 +183,7 @@ static int map_read_chunks(struct svcxprt_rdma *xprt,
183 ch_no++; 183 ch_no++;
184 ch++; 184 ch++;
185 chl_map->ch[ch_no].start = sge_no; 185 chl_map->ch[ch_no].start = sge_no;
186 ch_bytes = ch->rc_target.rs_length; 186 ch_bytes = ntohl(ch->rc_target.rs_length);
187 /* If bytes remaining account for next chunk */ 187 /* If bytes remaining account for next chunk */
188 if (byte_count) { 188 if (byte_count) {
189 head->arg.page_len += ch_bytes; 189 head->arg.page_len += ch_bytes;
@@ -281,11 +281,12 @@ static int fast_reg_read_chunks(struct svcxprt_rdma *xprt,
281 offset = 0; 281 offset = 0;
282 ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0]; 282 ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0];
283 for (ch_no = 0; ch_no < ch_count; ch_no++) { 283 for (ch_no = 0; ch_no < ch_count; ch_no++) {
284 int len = ntohl(ch->rc_target.rs_length);
284 rpl_map->sge[ch_no].iov_base = frmr->kva + offset; 285 rpl_map->sge[ch_no].iov_base = frmr->kva + offset;
285 rpl_map->sge[ch_no].iov_len = ch->rc_target.rs_length; 286 rpl_map->sge[ch_no].iov_len = len;
286 chl_map->ch[ch_no].count = 1; 287 chl_map->ch[ch_no].count = 1;
287 chl_map->ch[ch_no].start = ch_no; 288 chl_map->ch[ch_no].start = ch_no;
288 offset += ch->rc_target.rs_length; 289 offset += len;
289 ch++; 290 ch++;
290 } 291 }
291 292
@@ -316,7 +317,7 @@ static int rdma_set_ctxt_sge(struct svcxprt_rdma *xprt,
316 for (i = 0; i < count; i++) { 317 for (i = 0; i < count; i++) {
317 ctxt->sge[i].length = 0; /* in case map fails */ 318 ctxt->sge[i].length = 0; /* in case map fails */
318 if (!frmr) { 319 if (!frmr) {
319 BUG_ON(0 == virt_to_page(vec[i].iov_base)); 320 BUG_ON(!virt_to_page(vec[i].iov_base));
320 off = (unsigned long)vec[i].iov_base & ~PAGE_MASK; 321 off = (unsigned long)vec[i].iov_base & ~PAGE_MASK;
321 ctxt->sge[i].addr = 322 ctxt->sge[i].addr =
322 ib_dma_map_page(xprt->sc_cm_id->device, 323 ib_dma_map_page(xprt->sc_cm_id->device,
@@ -426,6 +427,7 @@ static int rdma_read_xdr(struct svcxprt_rdma *xprt,
426 427
427 for (ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0]; 428 for (ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0];
428 ch->rc_discrim != 0; ch++, ch_no++) { 429 ch->rc_discrim != 0; ch++, ch_no++) {
430 u64 rs_offset;
429next_sge: 431next_sge:
430 ctxt = svc_rdma_get_context(xprt); 432 ctxt = svc_rdma_get_context(xprt);
431 ctxt->direction = DMA_FROM_DEVICE; 433 ctxt->direction = DMA_FROM_DEVICE;
@@ -440,10 +442,10 @@ next_sge:
440 read_wr.opcode = IB_WR_RDMA_READ; 442 read_wr.opcode = IB_WR_RDMA_READ;
441 ctxt->wr_op = read_wr.opcode; 443 ctxt->wr_op = read_wr.opcode;
442 read_wr.send_flags = IB_SEND_SIGNALED; 444 read_wr.send_flags = IB_SEND_SIGNALED;
443 read_wr.wr.rdma.rkey = ch->rc_target.rs_handle; 445 read_wr.wr.rdma.rkey = ntohl(ch->rc_target.rs_handle);
444 read_wr.wr.rdma.remote_addr = 446 xdr_decode_hyper((__be32 *)&ch->rc_target.rs_offset,
445 get_unaligned(&(ch->rc_target.rs_offset)) + 447 &rs_offset);
446 sgl_offset; 448 read_wr.wr.rdma.remote_addr = rs_offset + sgl_offset;
447 read_wr.sg_list = ctxt->sge; 449 read_wr.sg_list = ctxt->sge;
448 read_wr.num_sge = 450 read_wr.num_sge =
449 rdma_read_max_sge(xprt, chl_map->ch[ch_no].count); 451 rdma_read_max_sge(xprt, chl_map->ch[ch_no].count);
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 249a835b703f..42eb7ba0b903 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -409,21 +409,21 @@ static int send_write_chunks(struct svcxprt_rdma *xprt,
409 u64 rs_offset; 409 u64 rs_offset;
410 410
411 arg_ch = &arg_ary->wc_array[chunk_no].wc_target; 411 arg_ch = &arg_ary->wc_array[chunk_no].wc_target;
412 write_len = min(xfer_len, arg_ch->rs_length); 412 write_len = min(xfer_len, ntohl(arg_ch->rs_length));
413 413
414 /* Prepare the response chunk given the length actually 414 /* Prepare the response chunk given the length actually
415 * written */ 415 * written */
416 rs_offset = get_unaligned(&(arg_ch->rs_offset)); 416 xdr_decode_hyper((__be32 *)&arg_ch->rs_offset, &rs_offset);
417 svc_rdma_xdr_encode_array_chunk(res_ary, chunk_no, 417 svc_rdma_xdr_encode_array_chunk(res_ary, chunk_no,
418 arg_ch->rs_handle, 418 arg_ch->rs_handle,
419 rs_offset, 419 arg_ch->rs_offset,
420 write_len); 420 write_len);
421 chunk_off = 0; 421 chunk_off = 0;
422 while (write_len) { 422 while (write_len) {
423 int this_write; 423 int this_write;
424 this_write = min(write_len, max_write); 424 this_write = min(write_len, max_write);
425 ret = send_write(xprt, rqstp, 425 ret = send_write(xprt, rqstp,
426 arg_ch->rs_handle, 426 ntohl(arg_ch->rs_handle),
427 rs_offset + chunk_off, 427 rs_offset + chunk_off,
428 xdr_off, 428 xdr_off,
429 this_write, 429 this_write,
@@ -457,6 +457,7 @@ static int send_reply_chunks(struct svcxprt_rdma *xprt,
457 u32 xdr_off; 457 u32 xdr_off;
458 int chunk_no; 458 int chunk_no;
459 int chunk_off; 459 int chunk_off;
460 int nchunks;
460 struct rpcrdma_segment *ch; 461 struct rpcrdma_segment *ch;
461 struct rpcrdma_write_array *arg_ary; 462 struct rpcrdma_write_array *arg_ary;
462 struct rpcrdma_write_array *res_ary; 463 struct rpcrdma_write_array *res_ary;
@@ -476,26 +477,27 @@ static int send_reply_chunks(struct svcxprt_rdma *xprt,
476 max_write = xprt->sc_max_sge * PAGE_SIZE; 477 max_write = xprt->sc_max_sge * PAGE_SIZE;
477 478
478 /* xdr offset starts at RPC message */ 479 /* xdr offset starts at RPC message */
480 nchunks = ntohl(arg_ary->wc_nchunks);
479 for (xdr_off = 0, chunk_no = 0; 481 for (xdr_off = 0, chunk_no = 0;
480 xfer_len && chunk_no < arg_ary->wc_nchunks; 482 xfer_len && chunk_no < nchunks;
481 chunk_no++) { 483 chunk_no++) {
482 u64 rs_offset; 484 u64 rs_offset;
483 ch = &arg_ary->wc_array[chunk_no].wc_target; 485 ch = &arg_ary->wc_array[chunk_no].wc_target;
484 write_len = min(xfer_len, ch->rs_length); 486 write_len = min(xfer_len, htonl(ch->rs_length));
485 487
486 /* Prepare the reply chunk given the length actually 488 /* Prepare the reply chunk given the length actually
487 * written */ 489 * written */
488 rs_offset = get_unaligned(&(ch->rs_offset)); 490 xdr_decode_hyper((__be32 *)&ch->rs_offset, &rs_offset);
489 svc_rdma_xdr_encode_array_chunk(res_ary, chunk_no, 491 svc_rdma_xdr_encode_array_chunk(res_ary, chunk_no,
490 ch->rs_handle, rs_offset, 492 ch->rs_handle, ch->rs_offset,
491 write_len); 493 write_len);
492 chunk_off = 0; 494 chunk_off = 0;
493 while (write_len) { 495 while (write_len) {
494 int this_write; 496 int this_write;
495 497
496 this_write = min(write_len, max_write); 498 this_write = min(write_len, max_write);
497 ret = send_write(xprt, rqstp, 499 ret = send_write(xprt, rqstp,
498 ch->rs_handle, 500 ntohl(ch->rs_handle),
499 rs_offset + chunk_off, 501 rs_offset + chunk_off,
500 xdr_off, 502 xdr_off,
501 this_write, 503 this_write,
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index 894cb42db91d..73b428bef598 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -51,6 +51,7 @@
51#include <rdma/rdma_cm.h> 51#include <rdma/rdma_cm.h>
52#include <linux/sunrpc/svc_rdma.h> 52#include <linux/sunrpc/svc_rdma.h>
53#include <linux/export.h> 53#include <linux/export.h>
54#include "xprt_rdma.h"
54 55
55#define RPCDBG_FACILITY RPCDBG_SVCXPRT 56#define RPCDBG_FACILITY RPCDBG_SVCXPRT
56 57
@@ -90,12 +91,6 @@ struct svc_xprt_class svc_rdma_class = {
90 .xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP, 91 .xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP,
91}; 92};
92 93
93/* WR context cache. Created in svc_rdma.c */
94extern struct kmem_cache *svc_rdma_ctxt_cachep;
95
96/* Workqueue created in svc_rdma.c */
97extern struct workqueue_struct *svc_rdma_wq;
98
99struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt) 94struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
100{ 95{
101 struct svc_rdma_op_ctxt *ctxt; 96 struct svc_rdma_op_ctxt *ctxt;
@@ -150,9 +145,6 @@ void svc_rdma_put_context(struct svc_rdma_op_ctxt *ctxt, int free_pages)
150 atomic_dec(&xprt->sc_ctxt_used); 145 atomic_dec(&xprt->sc_ctxt_used);
151} 146}
152 147
153/* Temporary NFS request map cache. Created in svc_rdma.c */
154extern struct kmem_cache *svc_rdma_map_cachep;
155
156/* 148/*
157 * Temporary NFS req mappings are shared across all transport 149 * Temporary NFS req mappings are shared across all transport
158 * instances. These are short lived and should be bounded by the number 150 * instances. These are short lived and should be bounded by the number
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
index 08c5d5a128fc..9a66c95b5837 100644
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -343,4 +343,11 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *);
343 */ 343 */
344int rpcrdma_marshal_req(struct rpc_rqst *); 344int rpcrdma_marshal_req(struct rpc_rqst *);
345 345
346/* Temporary NFS request map cache. Created in svc_rdma.c */
347extern struct kmem_cache *svc_rdma_map_cachep;
348/* WR context cache. Created in svc_rdma.c */
349extern struct kmem_cache *svc_rdma_ctxt_cachep;
350/* Workqueue created in svc_rdma.c */
351extern struct workqueue_struct *svc_rdma_wq;
352
346#endif /* _LINUX_SUNRPC_XPRT_RDMA_H */ 353#endif /* _LINUX_SUNRPC_XPRT_RDMA_H */
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 92bc5181dbeb..890b03f8d877 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2475,6 +2475,7 @@ static struct rpc_xprt_ops xs_tcp_ops = {
2475static struct rpc_xprt_ops bc_tcp_ops = { 2475static struct rpc_xprt_ops bc_tcp_ops = {
2476 .reserve_xprt = xprt_reserve_xprt, 2476 .reserve_xprt = xprt_reserve_xprt,
2477 .release_xprt = xprt_release_xprt, 2477 .release_xprt = xprt_release_xprt,
2478 .rpcbind = xs_local_rpcbind,
2478 .buf_alloc = bc_malloc, 2479 .buf_alloc = bc_malloc,
2479 .buf_free = bc_free, 2480 .buf_free = bc_free,
2480 .send_request = bc_send_request, 2481 .send_request = bc_send_request,
diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
index 39765bcfb472..920cabe0461b 100644
--- a/net/wireless/debugfs.c
+++ b/net/wireless/debugfs.c
@@ -13,12 +13,6 @@
13#include "core.h" 13#include "core.h"
14#include "debugfs.h" 14#include "debugfs.h"
15 15
16static int cfg80211_open_file_generic(struct inode *inode, struct file *file)
17{
18 file->private_data = inode->i_private;
19 return 0;
20}
21
22#define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ 16#define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \
23static ssize_t name## _read(struct file *file, char __user *userbuf, \ 17static ssize_t name## _read(struct file *file, char __user *userbuf, \
24 size_t count, loff_t *ppos) \ 18 size_t count, loff_t *ppos) \
@@ -33,7 +27,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
33 \ 27 \
34static const struct file_operations name## _ops = { \ 28static const struct file_operations name## _ops = { \
35 .read = name## _read, \ 29 .read = name## _read, \
36 .open = cfg80211_open_file_generic, \ 30 .open = simple_open, \
37 .llseek = generic_file_llseek, \ 31 .llseek = generic_file_llseek, \
38}; 32};
39 33
@@ -102,7 +96,7 @@ static ssize_t ht40allow_map_read(struct file *file,
102 96
103static const struct file_operations ht40allow_map_ops = { 97static const struct file_operations ht40allow_map_ops = {
104 .read = ht40allow_map_read, 98 .read = ht40allow_map_read,
105 .open = cfg80211_open_file_generic, 99 .open = simple_open,
106 .llseek = default_llseek, 100 .llseek = default_llseek,
107}; 101};
108 102