Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15576
b: refs/heads/master
c: 5ff7630
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and David S. Miller committed Jan 3, 2006
1 parent 995765e commit d9b484f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b461d2f2188c1c578ed651e4cdf608be7a993cd4
refs/heads/master: 5ff7630e4aa6c3969094dc30ff1cdaa6f52b0ed0
10 changes: 5 additions & 5 deletions trunk/net/netrom/af_netrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit d9b484f

Please sign in to comment.