]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/x25/af_x25.c
X25: remove bkl in routing ioctls
[net-next-2.6.git] / net / x25 / af_x25.c
index c99029bc411c41eecacdf9aa74526d404eb0d88e..2351aceb296d378fc32a94a8e6c3c2d0fb7d76e2 100644 (file)
@@ -1361,12 +1361,10 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                case TIOCOUTQ: {
                        int amount;
 
-                       lock_kernel();
                        amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
                        if (amount < 0)
                                amount = 0;
                        rc = put_user(amount, (unsigned int __user *)argp);
-                       unlock_kernel();
                        break;
                }
 
@@ -1377,29 +1375,25 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                         * These two are safe on a single CPU system as
                         * only user tasks fiddle here
                         */
-                       lock_kernel();
+                       lock_sock(sk);
                        if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
                                amount = skb->len;
+                       release_sock(sk);
                        rc = put_user(amount, (unsigned int __user *)argp);
-                       unlock_kernel();
                        break;
                }
 
                case SIOCGSTAMP:
                        rc = -EINVAL;
-                       lock_kernel();
                        if (sk)
                                rc = sock_get_timestamp(sk,
                                                (struct timeval __user *)argp);
-                       unlock_kernel();
                        break;
                case SIOCGSTAMPNS:
                        rc = -EINVAL;
-                       lock_kernel();
                        if (sk)
                                rc = sock_get_timestampns(sk,
                                                (struct timespec __user *)argp);
-                       unlock_kernel();
                        break;
                case SIOCGIFADDR:
                case SIOCSIFADDR:
@@ -1418,9 +1412,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        rc = -EPERM;
                        if (!capable(CAP_NET_ADMIN))
                                break;
-                       lock_kernel();
                        rc = x25_route_ioctl(cmd, argp);
-                       unlock_kernel();
                        break;
                case SIOCX25GSUBSCRIP:
                        lock_kernel();
@@ -1689,19 +1681,15 @@ static int compat_x25_ioctl(struct socket *sock, unsigned int cmd,
                break;
        case SIOCGSTAMP:
                rc = -EINVAL;
-               lock_kernel();
                if (sk)
                        rc = compat_sock_get_timestamp(sk,
                                        (struct timeval __user*)argp);
-               unlock_kernel();
                break;
        case SIOCGSTAMPNS:
                rc = -EINVAL;
-               lock_kernel();
                if (sk)
                        rc = compat_sock_get_timestampns(sk,
                                        (struct timespec __user*)argp);
-               unlock_kernel();
                break;
        case SIOCGIFADDR:
        case SIOCSIFADDR:
@@ -1720,9 +1708,7 @@ static int compat_x25_ioctl(struct socket *sock, unsigned int cmd,
                rc = -EPERM;
                if (!capable(CAP_NET_ADMIN))
                        break;
-               lock_kernel();
                rc = x25_route_ioctl(cmd, argp);
-               unlock_kernel();
                break;
        case SIOCX25GSUBSCRIP:
                lock_kernel();