aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/netrom/af_netrom.c10
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)
1166 void __user *argp = (void __user *)arg; 1166 void __user *argp = (void __user *)arg;
1167 int ret; 1167 int ret;
1168 1168
1169 lock_sock(sk);
1170 switch (cmd) { 1169 switch (cmd) {
1171 case TIOCOUTQ: { 1170 case TIOCOUTQ: {
1172 long amount; 1171 long amount;
1172
1173 lock_sock(sk);
1173 amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); 1174 amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
1174 if (amount < 0) 1175 if (amount < 0)
1175 amount = 0; 1176 amount = 0;
@@ -1180,6 +1181,8 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1180 case TIOCINQ: { 1181 case TIOCINQ: {
1181 struct sk_buff *skb; 1182 struct sk_buff *skb;
1182 long amount = 0L; 1183 long amount = 0L;
1184
1185 lock_sock(sk);
1183 /* These two are safe on a single CPU system as only user tasks fiddle here */ 1186 /* These two are safe on a single CPU system as only user tasks fiddle here */
1184 if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) 1187 if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
1185 amount = skb->len; 1188 amount = skb->len;
@@ -1188,6 +1191,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1188 } 1191 }
1189 1192
1190 case SIOCGSTAMP: 1193 case SIOCGSTAMP:
1194 lock_sock(sk);
1191 ret = sock_get_timestamp(sk, argp); 1195 ret = sock_get_timestamp(sk, argp);
1192 release_sock(sk); 1196 release_sock(sk);
1193 return ret; 1197 return ret;
@@ -1202,21 +1206,17 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1202 case SIOCSIFNETMASK: 1206 case SIOCSIFNETMASK:
1203 case SIOCGIFMETRIC: 1207 case SIOCGIFMETRIC:
1204 case SIOCSIFMETRIC: 1208 case SIOCSIFMETRIC:
1205 release_sock(sk);
1206 return -EINVAL; 1209 return -EINVAL;
1207 1210
1208 case SIOCADDRT: 1211 case SIOCADDRT:
1209 case SIOCDELRT: 1212 case SIOCDELRT:
1210 case SIOCNRDECOBS: 1213 case SIOCNRDECOBS:
1211 release_sock(sk);
1212 if (!capable(CAP_NET_ADMIN)) return -EPERM; 1214 if (!capable(CAP_NET_ADMIN)) return -EPERM;
1213 return nr_rt_ioctl(cmd, argp); 1215 return nr_rt_ioctl(cmd, argp);
1214 1216
1215 default: 1217 default:
1216 release_sock(sk);
1217 return dev_ioctl(cmd, argp); 1218 return dev_ioctl(cmd, argp);
1218 } 1219 }
1219 release_sock(sk);
1220 1220
1221 return 0; 1221 return 0;
1222} 1222}