diff options
author | Christoph Hellwig <hch@lst.de> | 2006-01-04 01:14:46 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-01-04 01:14:46 +0300 |
commit | 5ff7630e4aa6c3969094dc30ff1cdaa6f52b0ed0 (patch) | |
tree | a7905ac237dae4d9cf9f155a0aea33d904f67e96 /net/netrom | |
parent | b461d2f2188c1c578ed651e4cdf608be7a993cd4 (diff) | |
download | linux-5ff7630e4aa6c3969094dc30ff1cdaa6f52b0ed0.tar.xz |
[NETROM]: Remove unessecary lock_sock calls in netrom_ioctl()
lock_sock is needed only in very few cases, so do it there instead of
around the switch statement.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netrom')
-rw-r--r-- | net/netrom/af_netrom.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 05b653c05971..9ee672e19ec1 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -1166,10 +1166,11 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) void __user *argp = (void __user *)arg; int ret; - lock_sock(sk); switch (cmd) { case TIOCOUTQ: { long amount; + + lock_sock(sk); amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); if (amount < 0) amount = 0; @@ -1180,6 +1181,8 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case TIOCINQ: { struct sk_buff *skb; long amount = 0L; + + lock_sock(sk); /* These two are safe on a single CPU system as only user tasks fiddle here */ if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; @@ -1188,6 +1191,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) } case SIOCGSTAMP: + lock_sock(sk); ret = sock_get_timestamp(sk, argp); release_sock(sk); return ret; @@ -1202,21 +1206,17 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case SIOCSIFNETMASK: case SIOCGIFMETRIC: case SIOCSIFMETRIC: - release_sock(sk); return -EINVAL; case SIOCADDRT: case SIOCDELRT: case SIOCNRDECOBS: - release_sock(sk); if (!capable(CAP_NET_ADMIN)) return -EPERM; return nr_rt_ioctl(cmd, argp); default: - release_sock(sk); return dev_ioctl(cmd, argp); } - release_sock(sk); return 0; } |