From 25aa4efe4feb4150fe613169795df505c5018f2b Mon Sep 17 00:00:00 2001 From: andrew hendry Date: Tue, 14 Sep 2010 13:31:16 +0000 Subject: X.25 remove bkl in listen Listen updates socket values and needs lock_sock. Signed-off-by: Andrew Hendry Signed-off-by: David S. Miller --- net/x25/af_x25.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/x25') diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 5e86d4e97dce..f6a8f175b4f5 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -507,14 +507,14 @@ static int x25_listen(struct socket *sock, int backlog) struct sock *sk = sock->sk; int rc = -EOPNOTSUPP; - lock_kernel(); + lock_sock(sk); if (sk->sk_state != TCP_LISTEN) { memset(&x25_sk(sk)->dest_addr, 0, X25_ADDR_LEN); sk->sk_max_ack_backlog = backlog; sk->sk_state = TCP_LISTEN; rc = 0; } - unlock_kernel(); + release_sock(sk); return rc; } -- cgit v1.2.3 From 90c27297a9bfb8ea11c0e3f73ad90c4c66e8501e Mon Sep 17 00:00:00 2001 From: andrew hendry Date: Tue, 14 Sep 2010 13:31:38 +0000 Subject: X.25 remove bkl in bind Accept updates socket values in 3 lines so wrapped with lock_sock. Signed-off-by: Andrew Hendry Signed-off-by: David S. Miller --- net/x25/af_x25.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/x25') diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index f6a8f175b4f5..bd6fce31a738 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -688,7 +688,6 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) struct sockaddr_x25 *addr = (struct sockaddr_x25 *)uaddr; int len, i, rc = 0; - lock_kernel(); if (!sock_flag(sk, SOCK_ZAPPED) || addr_len != sizeof(struct sockaddr_x25) || addr->sx25_family != AF_X25) { @@ -704,12 +703,13 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) } } + lock_sock(sk); x25_sk(sk)->source_addr = addr->sx25_addr; x25_insert_socket(sk); sock_reset_flag(sk, SOCK_ZAPPED); + release_sock(sk); SOCK_DEBUG(sk, "x25_bind: socket is bound\n"); out: - unlock_kernel(); return rc; } -- cgit v1.2.3 From 141646ce56735cedb2336b3cd21364287f0aa4c7 Mon Sep 17 00:00:00 2001 From: Andrew Hendry Date: Tue, 14 Sep 2010 20:38:54 -0700 Subject: X.25 remove bkl in accept Accept already has socket locking. [ Extend socket locking over TCP_LISTEN state test. -DaveM ] Signed-off-by: Andrew Hendry Signed-off-by: David S. Miller --- net/x25/af_x25.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'net/x25') diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index bd6fce31a738..04321eec65e1 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -869,8 +869,7 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags) struct sk_buff *skb; int rc = -EINVAL; - lock_kernel(); - if (!sk || sk->sk_state != TCP_LISTEN) + if (!sk) goto out; rc = -EOPNOTSUPP; @@ -878,6 +877,10 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags) goto out; lock_sock(sk); + rc = -EINVAL; + if (sk->sk_state != TCP_LISTEN) + goto out2; + rc = x25_wait_for_data(sk, sk->sk_rcvtimeo); if (rc) goto out2; @@ -897,7 +900,6 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags) out2: release_sock(sk); out: - unlock_kernel(); return rc; } -- cgit v1.2.3 From 21a4591794c82c1a73f9d45d6400f878648261e3 Mon Sep 17 00:00:00 2001 From: andrew hendry Date: Tue, 14 Sep 2010 13:32:03 +0000 Subject: X.25 remove bkl in connect Connect already has socket locking. Signed-off-by: Andrew Hendry Signed-off-by: David S. Miller --- net/x25/af_x25.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'net/x25') diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 04321eec65e1..c1bbf9ec71f4 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -751,7 +751,6 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, struct x25_route *rt; int rc = 0; - lock_kernel(); lock_sock(sk); if (sk->sk_state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) { sock->state = SS_CONNECTED; @@ -829,7 +828,6 @@ out_put_route: x25_route_put(rt); out: release_sock(sk); - unlock_kernel(); return rc; } -- cgit v1.2.3 From 40e192c3ff7b1af680b0b03e94cadf1dad5fb82e Mon Sep 17 00:00:00 2001 From: andrew hendry Date: Tue, 21 Sep 2010 15:24:25 +0000 Subject: X.25 remove bkl in getsockname Signed-off-by: Andrew Hendry Signed-off-by: David S. Miller --- net/x25/af_x25.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'net/x25') diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index c1bbf9ec71f4..dc6767ecdaf8 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -909,7 +909,6 @@ static int x25_getname(struct socket *sock, struct sockaddr *uaddr, struct x25_sock *x25 = x25_sk(sk); int rc = 0; - lock_kernel(); if (peer) { if (sk->sk_state != TCP_ESTABLISHED) { rc = -ENOTCONN; @@ -923,7 +922,6 @@ static int x25_getname(struct socket *sock, struct sockaddr *uaddr, *uaddr_len = sizeof(*sx25); out: - unlock_kernel(); return rc; } -- cgit v1.2.3 From 768190fdc058cc7405330f7782782df084c25d61 Mon Sep 17 00:00:00 2001 From: andrew hendry Date: Tue, 21 Sep 2010 15:24:45 +0000 Subject: X.25 remove bkl in poll The x25_datagram_poll didn't add anything, removed it. Signed-off-by: Andrew Hendry Signed-off-by: David S. Miller --- net/x25/af_x25.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'net/x25') diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index dc6767ecdaf8..f7af98dff409 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -925,18 +925,6 @@ out: return rc; } -static unsigned int x25_datagram_poll(struct file *file, struct socket *sock, - poll_table *wait) -{ - int rc; - - lock_kernel(); - rc = datagram_poll(file, sock, wait); - unlock_kernel(); - - return rc; -} - int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb, unsigned int lci) { @@ -1744,7 +1732,7 @@ static const struct proto_ops x25_proto_ops = { .socketpair = sock_no_socketpair, .accept = x25_accept, .getname = x25_getname, - .poll = x25_datagram_poll, + .poll = datagram_poll, .ioctl = x25_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = compat_x25_ioctl, -- cgit v1.2.3