aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:21:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:21:00 -0400
commitf74b9444192c60603020c61d7915b72893137edc (patch)
tree8b1d16d373234038c2b045c9ceb3c33b93059e8a /net
parent7a6362800cb7d1d618a697a650c7aaed3eb39320 (diff)
parent4ba8216cd90560bc402f52076f64d8546e8aefcb (diff)
Merge branch 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
* 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl: BKL: That's all, folks fs/locks.c: Remove stale FIXME left over from BKL conversion ipx: remove the BKL appletalk: remove the BKL x25: remove the BKL ufs: remove the BKL hpfs: remove the BKL drivers: remove extraneous includes of smp_lock.h tracing: don't trace the BKL adfs: remove the big kernel lock
Diffstat (limited to 'net')
-rw-r--r--net/appletalk/ddp.c40
-rw-r--r--net/ipx/Kconfig1
-rw-r--r--net/ipx/af_ipx.c52
-rw-r--r--net/x25/Kconfig1
-rw-r--r--net/x25/af_x25.c58
-rw-r--r--net/x25/x25_out.c7
6 files changed, 59 insertions, 100 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index c410b93fda2e..3d4f4b043406 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -54,7 +54,6 @@
54#include <linux/capability.h> 54#include <linux/capability.h>
55#include <linux/module.h> 55#include <linux/module.h>
56#include <linux/if_arp.h> 56#include <linux/if_arp.h>
57#include <linux/smp_lock.h>
58#include <linux/termios.h> /* For TIOCOUTQ/INQ */ 57#include <linux/termios.h> /* For TIOCOUTQ/INQ */
59#include <linux/compat.h> 58#include <linux/compat.h>
60#include <linux/slab.h> 59#include <linux/slab.h>
@@ -1052,13 +1051,13 @@ static int atalk_release(struct socket *sock)
1052{ 1051{
1053 struct sock *sk = sock->sk; 1052 struct sock *sk = sock->sk;
1054 1053
1055 lock_kernel(); 1054 lock_sock(sk);
1056 if (sk) { 1055 if (sk) {
1057 sock_orphan(sk); 1056 sock_orphan(sk);
1058 sock->sk = NULL; 1057 sock->sk = NULL;
1059 atalk_destroy_socket(sk); 1058 atalk_destroy_socket(sk);
1060 } 1059 }
1061 unlock_kernel(); 1060 release_sock(sk);
1062 return 0; 1061 return 0;
1063} 1062}
1064 1063
@@ -1143,7 +1142,7 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1143 if (addr->sat_family != AF_APPLETALK) 1142 if (addr->sat_family != AF_APPLETALK)
1144 return -EAFNOSUPPORT; 1143 return -EAFNOSUPPORT;
1145 1144
1146 lock_kernel(); 1145 lock_sock(sk);
1147 if (addr->sat_addr.s_net == htons(ATADDR_ANYNET)) { 1146 if (addr->sat_addr.s_net == htons(ATADDR_ANYNET)) {
1148 struct atalk_addr *ap = atalk_find_primary(); 1147 struct atalk_addr *ap = atalk_find_primary();
1149 1148
@@ -1179,7 +1178,7 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1179 sock_reset_flag(sk, SOCK_ZAPPED); 1178 sock_reset_flag(sk, SOCK_ZAPPED);
1180 err = 0; 1179 err = 0;
1181out: 1180out:
1182 unlock_kernel(); 1181 release_sock(sk);
1183 return err; 1182 return err;
1184} 1183}
1185 1184
@@ -1215,7 +1214,7 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr,
1215#endif 1214#endif
1216 } 1215 }
1217 1216
1218 lock_kernel(); 1217 lock_sock(sk);
1219 err = -EBUSY; 1218 err = -EBUSY;
1220 if (sock_flag(sk, SOCK_ZAPPED)) 1219 if (sock_flag(sk, SOCK_ZAPPED))
1221 if (atalk_autobind(sk) < 0) 1220 if (atalk_autobind(sk) < 0)
@@ -1233,7 +1232,7 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr,
1233 sk->sk_state = TCP_ESTABLISHED; 1232 sk->sk_state = TCP_ESTABLISHED;
1234 err = 0; 1233 err = 0;
1235out: 1234out:
1236 unlock_kernel(); 1235 release_sock(sk);
1237 return err; 1236 return err;
1238} 1237}
1239 1238
@@ -1249,7 +1248,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr,
1249 struct atalk_sock *at = at_sk(sk); 1248 struct atalk_sock *at = at_sk(sk);
1250 int err; 1249 int err;
1251 1250
1252 lock_kernel(); 1251 lock_sock(sk);
1253 err = -ENOBUFS; 1252 err = -ENOBUFS;
1254 if (sock_flag(sk, SOCK_ZAPPED)) 1253 if (sock_flag(sk, SOCK_ZAPPED))
1255 if (atalk_autobind(sk) < 0) 1254 if (atalk_autobind(sk) < 0)
@@ -1277,17 +1276,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr,
1277 memcpy(uaddr, &sat, sizeof(sat)); 1276 memcpy(uaddr, &sat, sizeof(sat));
1278 1277
1279out: 1278out:
1280 unlock_kernel(); 1279 release_sock(sk);
1281 return err;
1282}
1283
1284static unsigned int atalk_poll(struct file *file, struct socket *sock,
1285 poll_table *wait)
1286{
1287 int err;
1288 lock_kernel();
1289 err = datagram_poll(file, sock, wait);
1290 unlock_kernel();
1291 return err; 1280 return err;
1292} 1281}
1293 1282
@@ -1596,7 +1585,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1596 if (len > DDP_MAXSZ) 1585 if (len > DDP_MAXSZ)
1597 return -EMSGSIZE; 1586 return -EMSGSIZE;
1598 1587
1599 lock_kernel(); 1588 lock_sock(sk);
1600 if (usat) { 1589 if (usat) {
1601 err = -EBUSY; 1590 err = -EBUSY;
1602 if (sock_flag(sk, SOCK_ZAPPED)) 1591 if (sock_flag(sk, SOCK_ZAPPED))
@@ -1651,7 +1640,9 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1651 sk, size, dev->name); 1640 sk, size, dev->name);
1652 1641
1653 size += dev->hard_header_len; 1642 size += dev->hard_header_len;
1643 release_sock(sk);
1654 skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err); 1644 skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err);
1645 lock_sock(sk);
1655 if (!skb) 1646 if (!skb)
1656 goto out; 1647 goto out;
1657 1648
@@ -1738,7 +1729,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1738 SOCK_DEBUG(sk, "SK %p: Done write (%Zd).\n", sk, len); 1729 SOCK_DEBUG(sk, "SK %p: Done write (%Zd).\n", sk, len);
1739 1730
1740out: 1731out:
1741 unlock_kernel(); 1732 release_sock(sk);
1742 return err ? : len; 1733 return err ? : len;
1743} 1734}
1744 1735
@@ -1753,9 +1744,10 @@ static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1753 int err = 0; 1744 int err = 0;
1754 struct sk_buff *skb; 1745 struct sk_buff *skb;
1755 1746
1756 lock_kernel();
1757 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, 1747 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
1758 flags & MSG_DONTWAIT, &err); 1748 flags & MSG_DONTWAIT, &err);
1749 lock_sock(sk);
1750
1759 if (!skb) 1751 if (!skb)
1760 goto out; 1752 goto out;
1761 1753
@@ -1787,7 +1779,7 @@ static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1787 skb_free_datagram(sk, skb); /* Free the datagram. */ 1779 skb_free_datagram(sk, skb); /* Free the datagram. */
1788 1780
1789out: 1781out:
1790 unlock_kernel(); 1782 release_sock(sk);
1791 return err ? : copied; 1783 return err ? : copied;
1792} 1784}
1793 1785
@@ -1887,7 +1879,7 @@ static const struct proto_ops atalk_dgram_ops = {
1887 .socketpair = sock_no_socketpair, 1879 .socketpair = sock_no_socketpair,
1888 .accept = sock_no_accept, 1880 .accept = sock_no_accept,
1889 .getname = atalk_getname, 1881 .getname = atalk_getname,
1890 .poll = atalk_poll, 1882 .poll = datagram_poll,
1891 .ioctl = atalk_ioctl, 1883 .ioctl = atalk_ioctl,
1892#ifdef CONFIG_COMPAT 1884#ifdef CONFIG_COMPAT
1893 .compat_ioctl = atalk_compat_ioctl, 1885 .compat_ioctl = atalk_compat_ioctl,
diff --git a/net/ipx/Kconfig b/net/ipx/Kconfig
index 02549cb2c328..e9ad0062fbb6 100644
--- a/net/ipx/Kconfig
+++ b/net/ipx/Kconfig
@@ -3,7 +3,6 @@
3# 3#
4config IPX 4config IPX
5 tristate "The IPX protocol" 5 tristate "The IPX protocol"
6 depends on BKL # should be fixable
7 select LLC 6 select LLC
8 ---help--- 7 ---help---
9 This is support for the Novell networking protocol, IPX, commonly 8 This is support for the Novell networking protocol, IPX, commonly
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index da3d21c41d90..2731b51923d1 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -42,7 +42,6 @@
42#include <linux/uio.h> 42#include <linux/uio.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/skbuff.h> 44#include <linux/skbuff.h>
45#include <linux/smp_lock.h>
46#include <linux/socket.h> 45#include <linux/socket.h>
47#include <linux/sockios.h> 46#include <linux/sockios.h>
48#include <linux/string.h> 47#include <linux/string.h>
@@ -1299,7 +1298,7 @@ static int ipx_setsockopt(struct socket *sock, int level, int optname,
1299 int opt; 1298 int opt;
1300 int rc = -EINVAL; 1299 int rc = -EINVAL;
1301 1300
1302 lock_kernel(); 1301 lock_sock(sk);
1303 if (optlen != sizeof(int)) 1302 if (optlen != sizeof(int))
1304 goto out; 1303 goto out;
1305 1304
@@ -1314,7 +1313,7 @@ static int ipx_setsockopt(struct socket *sock, int level, int optname,
1314 ipx_sk(sk)->type = opt; 1313 ipx_sk(sk)->type = opt;
1315 rc = 0; 1314 rc = 0;
1316out: 1315out:
1317 unlock_kernel(); 1316 release_sock(sk);
1318 return rc; 1317 return rc;
1319} 1318}
1320 1319
@@ -1326,7 +1325,7 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname,
1326 int len; 1325 int len;
1327 int rc = -ENOPROTOOPT; 1326 int rc = -ENOPROTOOPT;
1328 1327
1329 lock_kernel(); 1328 lock_sock(sk);
1330 if (!(level == SOL_IPX && optname == IPX_TYPE)) 1329 if (!(level == SOL_IPX && optname == IPX_TYPE))
1331 goto out; 1330 goto out;
1332 1331
@@ -1347,7 +1346,7 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname,
1347 1346
1348 rc = 0; 1347 rc = 0;
1349out: 1348out:
1350 unlock_kernel(); 1349 release_sock(sk);
1351 return rc; 1350 return rc;
1352} 1351}
1353 1352
@@ -1396,7 +1395,7 @@ static int ipx_release(struct socket *sock)
1396 if (!sk) 1395 if (!sk)
1397 goto out; 1396 goto out;
1398 1397
1399 lock_kernel(); 1398 lock_sock(sk);
1400 if (!sock_flag(sk, SOCK_DEAD)) 1399 if (!sock_flag(sk, SOCK_DEAD))
1401 sk->sk_state_change(sk); 1400 sk->sk_state_change(sk);
1402 1401
@@ -1404,7 +1403,7 @@ static int ipx_release(struct socket *sock)
1404 sock->sk = NULL; 1403 sock->sk = NULL;
1405 sk_refcnt_debug_release(sk); 1404 sk_refcnt_debug_release(sk);
1406 ipx_destroy_socket(sk); 1405 ipx_destroy_socket(sk);
1407 unlock_kernel(); 1406 release_sock(sk);
1408out: 1407out:
1409 return 0; 1408 return 0;
1410} 1409}
@@ -1530,11 +1529,12 @@ out:
1530 1529
1531static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) 1530static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1532{ 1531{
1532 struct sock *sk = sock->sk;
1533 int rc; 1533 int rc;
1534 1534
1535 lock_kernel(); 1535 lock_sock(sk);
1536 rc = __ipx_bind(sock, uaddr, addr_len); 1536 rc = __ipx_bind(sock, uaddr, addr_len);
1537 unlock_kernel(); 1537 release_sock(sk);
1538 1538
1539 return rc; 1539 return rc;
1540} 1540}
@@ -1551,7 +1551,7 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr,
1551 sk->sk_state = TCP_CLOSE; 1551 sk->sk_state = TCP_CLOSE;
1552 sock->state = SS_UNCONNECTED; 1552 sock->state = SS_UNCONNECTED;
1553 1553
1554 lock_kernel(); 1554 lock_sock(sk);
1555 if (addr_len != sizeof(*addr)) 1555 if (addr_len != sizeof(*addr))
1556 goto out; 1556 goto out;
1557 addr = (struct sockaddr_ipx *)uaddr; 1557 addr = (struct sockaddr_ipx *)uaddr;
@@ -1598,7 +1598,7 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr,
1598 ipxrtr_put(rt); 1598 ipxrtr_put(rt);
1599 rc = 0; 1599 rc = 0;
1600out: 1600out:
1601 unlock_kernel(); 1601 release_sock(sk);
1602 return rc; 1602 return rc;
1603} 1603}
1604 1604
@@ -1614,7 +1614,7 @@ static int ipx_getname(struct socket *sock, struct sockaddr *uaddr,
1614 1614
1615 *uaddr_len = sizeof(struct sockaddr_ipx); 1615 *uaddr_len = sizeof(struct sockaddr_ipx);
1616 1616
1617 lock_kernel(); 1617 lock_sock(sk);
1618 if (peer) { 1618 if (peer) {
1619 rc = -ENOTCONN; 1619 rc = -ENOTCONN;
1620 if (sk->sk_state != TCP_ESTABLISHED) 1620 if (sk->sk_state != TCP_ESTABLISHED)
@@ -1649,19 +1649,7 @@ static int ipx_getname(struct socket *sock, struct sockaddr *uaddr,
1649 1649
1650 rc = 0; 1650 rc = 0;
1651out: 1651out:
1652 unlock_kernel(); 1652 release_sock(sk);
1653 return rc;
1654}
1655
1656static unsigned int ipx_datagram_poll(struct file *file, struct socket *sock,
1657 poll_table *wait)
1658{
1659 int rc;
1660
1661 lock_kernel();
1662 rc = datagram_poll(file, sock, wait);
1663 unlock_kernel();
1664
1665 return rc; 1653 return rc;
1666} 1654}
1667 1655
@@ -1736,7 +1724,7 @@ static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock,
1736 int rc = -EINVAL; 1724 int rc = -EINVAL;
1737 int flags = msg->msg_flags; 1725 int flags = msg->msg_flags;
1738 1726
1739 lock_kernel(); 1727 lock_sock(sk);
1740 /* Socket gets bound below anyway */ 1728 /* Socket gets bound below anyway */
1741/* if (sk->sk_zapped) 1729/* if (sk->sk_zapped)
1742 return -EIO; */ /* Socket not bound */ 1730 return -EIO; */ /* Socket not bound */
@@ -1788,7 +1776,7 @@ static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock,
1788 if (rc >= 0) 1776 if (rc >= 0)
1789 rc = len; 1777 rc = len;
1790out: 1778out:
1791 unlock_kernel(); 1779 release_sock(sk);
1792 return rc; 1780 return rc;
1793} 1781}
1794 1782
@@ -1803,7 +1791,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
1803 struct sk_buff *skb; 1791 struct sk_buff *skb;
1804 int copied, rc; 1792 int copied, rc;
1805 1793
1806 lock_kernel(); 1794 lock_sock(sk);
1807 /* put the autobinding in */ 1795 /* put the autobinding in */
1808 if (!ipxs->port) { 1796 if (!ipxs->port) {
1809 struct sockaddr_ipx uaddr; 1797 struct sockaddr_ipx uaddr;
@@ -1862,7 +1850,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
1862out_free: 1850out_free:
1863 skb_free_datagram(sk, skb); 1851 skb_free_datagram(sk, skb);
1864out: 1852out:
1865 unlock_kernel(); 1853 release_sock(sk);
1866 return rc; 1854 return rc;
1867} 1855}
1868 1856
@@ -1874,7 +1862,7 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1874 struct sock *sk = sock->sk; 1862 struct sock *sk = sock->sk;
1875 void __user *argp = (void __user *)arg; 1863 void __user *argp = (void __user *)arg;
1876 1864
1877 lock_kernel(); 1865 lock_sock(sk);
1878 switch (cmd) { 1866 switch (cmd) {
1879 case TIOCOUTQ: 1867 case TIOCOUTQ:
1880 amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); 1868 amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
@@ -1937,7 +1925,7 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1937 rc = -ENOIOCTLCMD; 1925 rc = -ENOIOCTLCMD;
1938 break; 1926 break;
1939 } 1927 }
1940 unlock_kernel(); 1928 release_sock(sk);
1941 1929
1942 return rc; 1930 return rc;
1943} 1931}
@@ -1984,7 +1972,7 @@ static const struct proto_ops ipx_dgram_ops = {
1984 .socketpair = sock_no_socketpair, 1972 .socketpair = sock_no_socketpair,
1985 .accept = sock_no_accept, 1973 .accept = sock_no_accept,
1986 .getname = ipx_getname, 1974 .getname = ipx_getname,
1987 .poll = ipx_datagram_poll, 1975 .poll = datagram_poll,
1988 .ioctl = ipx_ioctl, 1976 .ioctl = ipx_ioctl,
1989#ifdef CONFIG_COMPAT 1977#ifdef CONFIG_COMPAT
1990 .compat_ioctl = ipx_compat_ioctl, 1978 .compat_ioctl = ipx_compat_ioctl,
diff --git a/net/x25/Kconfig b/net/x25/Kconfig
index 2196e55e4f61..e6759c9660bb 100644
--- a/net/x25/Kconfig
+++ b/net/x25/Kconfig
@@ -5,7 +5,6 @@
5config X25 5config X25
6 tristate "CCITT X.25 Packet Layer (EXPERIMENTAL)" 6 tristate "CCITT X.25 Packet Layer (EXPERIMENTAL)"
7 depends on EXPERIMENTAL 7 depends on EXPERIMENTAL
8 depends on BKL # should be fixable
9 ---help--- 8 ---help---
10 X.25 is a set of standardized network protocols, similar in scope to 9 X.25 is a set of standardized network protocols, similar in scope to
11 frame relay; the one physical line from your box to the X.25 network 10 frame relay; the one physical line from your box to the X.25 network
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index ad96ee90fe27..4680b1e4c79c 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -40,7 +40,6 @@
40#include <linux/errno.h> 40#include <linux/errno.h>
41#include <linux/kernel.h> 41#include <linux/kernel.h>
42#include <linux/sched.h> 42#include <linux/sched.h>
43#include <linux/smp_lock.h>
44#include <linux/timer.h> 43#include <linux/timer.h>
45#include <linux/string.h> 44#include <linux/string.h>
46#include <linux/net.h> 45#include <linux/net.h>
@@ -432,15 +431,6 @@ void x25_destroy_socket_from_timer(struct sock *sk)
432 sock_put(sk); 431 sock_put(sk);
433} 432}
434 433
435static void x25_destroy_socket(struct sock *sk)
436{
437 sock_hold(sk);
438 lock_sock(sk);
439 __x25_destroy_socket(sk);
440 release_sock(sk);
441 sock_put(sk);
442}
443
444/* 434/*
445 * Handling for system calls applied via the various interfaces to a 435 * Handling for system calls applied via the various interfaces to a
446 * X.25 socket object. 436 * X.25 socket object.
@@ -647,18 +637,19 @@ static int x25_release(struct socket *sock)
647 struct sock *sk = sock->sk; 637 struct sock *sk = sock->sk;
648 struct x25_sock *x25; 638 struct x25_sock *x25;
649 639
650 lock_kernel();
651 if (!sk) 640 if (!sk)
652 goto out; 641 return 0;
653 642
654 x25 = x25_sk(sk); 643 x25 = x25_sk(sk);
655 644
645 sock_hold(sk);
646 lock_sock(sk);
656 switch (x25->state) { 647 switch (x25->state) {
657 648
658 case X25_STATE_0: 649 case X25_STATE_0:
659 case X25_STATE_2: 650 case X25_STATE_2:
660 x25_disconnect(sk, 0, 0, 0); 651 x25_disconnect(sk, 0, 0, 0);
661 x25_destroy_socket(sk); 652 __x25_destroy_socket(sk);
662 goto out; 653 goto out;
663 654
664 case X25_STATE_1: 655 case X25_STATE_1:
@@ -678,7 +669,8 @@ static int x25_release(struct socket *sock)
678 669
679 sock_orphan(sk); 670 sock_orphan(sk);
680out: 671out:
681 unlock_kernel(); 672 release_sock(sk);
673 sock_put(sk);
682 return 0; 674 return 0;
683} 675}
684 676
@@ -1085,7 +1077,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
1085 size_t size; 1077 size_t size;
1086 int qbit = 0, rc = -EINVAL; 1078 int qbit = 0, rc = -EINVAL;
1087 1079
1088 lock_kernel(); 1080 lock_sock(sk);
1089 if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_OOB|MSG_EOR|MSG_CMSG_COMPAT)) 1081 if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_OOB|MSG_EOR|MSG_CMSG_COMPAT))
1090 goto out; 1082 goto out;
1091 1083
@@ -1148,7 +1140,9 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
1148 1140
1149 size = len + X25_MAX_L2_LEN + X25_EXT_MIN_LEN; 1141 size = len + X25_MAX_L2_LEN + X25_EXT_MIN_LEN;
1150 1142
1143 release_sock(sk);
1151 skb = sock_alloc_send_skb(sk, size, noblock, &rc); 1144 skb = sock_alloc_send_skb(sk, size, noblock, &rc);
1145 lock_sock(sk);
1152 if (!skb) 1146 if (!skb)
1153 goto out; 1147 goto out;
1154 X25_SKB_CB(skb)->flags = msg->msg_flags; 1148 X25_SKB_CB(skb)->flags = msg->msg_flags;
@@ -1231,26 +1225,10 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
1231 len++; 1225 len++;
1232 } 1226 }
1233 1227
1234 /*
1235 * lock_sock() is currently only used to serialize this x25_kick()
1236 * against input-driven x25_kick() calls. It currently only blocks
1237 * incoming packets for this socket and does not protect against
1238 * any other socket state changes and is not called from anywhere
1239 * else. As x25_kick() cannot block and as long as all socket
1240 * operations are BKL-wrapped, we don't need take to care about
1241 * purging the backlog queue in x25_release().
1242 *
1243 * Using lock_sock() to protect all socket operations entirely
1244 * (and making the whole x25 stack SMP aware) unfortunately would
1245 * require major changes to {send,recv}msg and skb allocation methods.
1246 * -> 2.5 ;)
1247 */
1248 lock_sock(sk);
1249 x25_kick(sk); 1228 x25_kick(sk);
1250 release_sock(sk);
1251 rc = len; 1229 rc = len;
1252out: 1230out:
1253 unlock_kernel(); 1231 release_sock(sk);
1254 return rc; 1232 return rc;
1255out_kfree_skb: 1233out_kfree_skb:
1256 kfree_skb(skb); 1234 kfree_skb(skb);
@@ -1271,7 +1249,7 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
1271 unsigned char *asmptr; 1249 unsigned char *asmptr;
1272 int rc = -ENOTCONN; 1250 int rc = -ENOTCONN;
1273 1251
1274 lock_kernel(); 1252 lock_sock(sk);
1275 /* 1253 /*
1276 * This works for seqpacket too. The receiver has ordered the queue for 1254 * This works for seqpacket too. The receiver has ordered the queue for
1277 * us! We do one quick check first though 1255 * us! We do one quick check first though
@@ -1300,8 +1278,10 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
1300 msg->msg_flags |= MSG_OOB; 1278 msg->msg_flags |= MSG_OOB;
1301 } else { 1279 } else {
1302 /* Now we can treat all alike */ 1280 /* Now we can treat all alike */
1281 release_sock(sk);
1303 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, 1282 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
1304 flags & MSG_DONTWAIT, &rc); 1283 flags & MSG_DONTWAIT, &rc);
1284 lock_sock(sk);
1305 if (!skb) 1285 if (!skb)
1306 goto out; 1286 goto out;
1307 1287
@@ -1338,14 +1318,12 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
1338 1318
1339 msg->msg_namelen = sizeof(struct sockaddr_x25); 1319 msg->msg_namelen = sizeof(struct sockaddr_x25);
1340 1320
1341 lock_sock(sk);
1342 x25_check_rbuf(sk); 1321 x25_check_rbuf(sk);
1343 release_sock(sk);
1344 rc = copied; 1322 rc = copied;
1345out_free_dgram: 1323out_free_dgram:
1346 skb_free_datagram(sk, skb); 1324 skb_free_datagram(sk, skb);
1347out: 1325out:
1348 unlock_kernel(); 1326 release_sock(sk);
1349 return rc; 1327 return rc;
1350} 1328}
1351 1329
@@ -1581,18 +1559,18 @@ out_cud_release:
1581 1559
1582 case SIOCX25CALLACCPTAPPRV: { 1560 case SIOCX25CALLACCPTAPPRV: {
1583 rc = -EINVAL; 1561 rc = -EINVAL;
1584 lock_kernel(); 1562 lock_sock(sk);
1585 if (sk->sk_state != TCP_CLOSE) 1563 if (sk->sk_state != TCP_CLOSE)
1586 break; 1564 break;
1587 clear_bit(X25_ACCPT_APPRV_FLAG, &x25->flags); 1565 clear_bit(X25_ACCPT_APPRV_FLAG, &x25->flags);
1588 unlock_kernel(); 1566 release_sock(sk);
1589 rc = 0; 1567 rc = 0;
1590 break; 1568 break;
1591 } 1569 }
1592 1570
1593 case SIOCX25SENDCALLACCPT: { 1571 case SIOCX25SENDCALLACCPT: {
1594 rc = -EINVAL; 1572 rc = -EINVAL;
1595 lock_kernel(); 1573 lock_sock(sk);
1596 if (sk->sk_state != TCP_ESTABLISHED) 1574 if (sk->sk_state != TCP_ESTABLISHED)
1597 break; 1575 break;
1598 /* must call accptapprv above */ 1576 /* must call accptapprv above */
@@ -1600,7 +1578,7 @@ out_cud_release:
1600 break; 1578 break;
1601 x25_write_internal(sk, X25_CALL_ACCEPTED); 1579 x25_write_internal(sk, X25_CALL_ACCEPTED);
1602 x25->state = X25_STATE_3; 1580 x25->state = X25_STATE_3;
1603 unlock_kernel(); 1581 release_sock(sk);
1604 rc = 0; 1582 rc = 0;
1605 break; 1583 break;
1606 } 1584 }
diff --git a/net/x25/x25_out.c b/net/x25/x25_out.c
index d00649fb251d..0144271d2184 100644
--- a/net/x25/x25_out.c
+++ b/net/x25/x25_out.c
@@ -68,8 +68,11 @@ int x25_output(struct sock *sk, struct sk_buff *skb)
68 frontlen = skb_headroom(skb); 68 frontlen = skb_headroom(skb);
69 69
70 while (skb->len > 0) { 70 while (skb->len > 0) {
71 if ((skbn = sock_alloc_send_skb(sk, frontlen + max_len, 71 release_sock(sk);
72 noblock, &err)) == NULL){ 72 skbn = sock_alloc_send_skb(sk, frontlen + max_len,
73 noblock, &err);
74 lock_sock(sk);
75 if (!skbn) {
73 if (err == -EWOULDBLOCK && noblock){ 76 if (err == -EWOULDBLOCK && noblock){
74 kfree_skb(skb); 77 kfree_skb(skb);
75 return sent; 78 return sent;