Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224511
b: refs/heads/master
c: f90de66
h: refs/heads/master
i:
  224509: 220ab41
  224507: cf7c099
  224503: ec3fbf1
  224495: a6695cf
  224479: 5cd8b96
  224447: b026b34
  224383: 179c830
  224255: 142e3d1
v: v3
  • Loading branch information
andrew hendry authored and David S. Miller committed Nov 28, 2010
1 parent 72fcf5f commit 44fef57
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 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: 5595a1a5997953dbd8c5df7c2f7d4b3a2eb2be4b
refs/heads/master: f90de660678cf553f63c387945830a2e4d26dd3e
48 changes: 25 additions & 23 deletions trunk/net/x25/af_x25.c
Original file line number Diff line number Diff line change
Expand Up @@ -1424,62 +1424,63 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
rc = x25_subscr_ioctl(cmd, argp);
break;
case SIOCX25GFACILITIES: {
struct x25_facilities fac = x25->facilities;
lock_kernel();
rc = copy_to_user(argp, &fac,
sizeof(fac)) ? -EFAULT : 0;
unlock_kernel();
lock_sock(sk);
rc = copy_to_user(argp, &x25->facilities,
sizeof(x25->facilities))
? -EFAULT : 0;
release_sock(sk);
break;
}

case SIOCX25SFACILITIES: {
struct x25_facilities facilities;
rc = -EFAULT;
lock_kernel();
if (copy_from_user(&facilities, argp,
sizeof(facilities)))
break;
rc = -EINVAL;
lock_sock(sk);
if (sk->sk_state != TCP_LISTEN &&
sk->sk_state != TCP_CLOSE)
break;
goto out_fac_release;
if (facilities.pacsize_in < X25_PS16 ||
facilities.pacsize_in > X25_PS4096)
break;
goto out_fac_release;
if (facilities.pacsize_out < X25_PS16 ||
facilities.pacsize_out > X25_PS4096)
break;
goto out_fac_release;
if (facilities.winsize_in < 1 ||
facilities.winsize_in > 127)
break;
goto out_fac_release;
if (facilities.throughput) {
int out = facilities.throughput & 0xf0;
int in = facilities.throughput & 0x0f;
if (!out)
facilities.throughput |=
X25_DEFAULT_THROUGHPUT << 4;
else if (out < 0x30 || out > 0xD0)
break;
goto out_fac_release;
if (!in)
facilities.throughput |=
X25_DEFAULT_THROUGHPUT;
else if (in < 0x03 || in > 0x0D)
break;
goto out_fac_release;
}
if (facilities.reverse &&
(facilities.reverse & 0x81) != 0x81)
break;
goto out_fac_release;
x25->facilities = facilities;
rc = 0;
unlock_kernel();
out_fac_release:
release_sock(sk);
break;
}

case SIOCX25GDTEFACILITIES: {
lock_kernel();
lock_sock(sk);
rc = copy_to_user(argp, &x25->dte_facilities,
sizeof(x25->dte_facilities));
unlock_kernel();
release_sock(sk);
if (rc)
rc = -EFAULT;
break;
Expand All @@ -1488,24 +1489,25 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCX25SDTEFACILITIES: {
struct x25_dte_facilities dtefacs;
rc = -EFAULT;
lock_kernel();
if (copy_from_user(&dtefacs, argp, sizeof(dtefacs)))
break;
rc = -EINVAL;
lock_sock(sk);
if (sk->sk_state != TCP_LISTEN &&
sk->sk_state != TCP_CLOSE)
break;
goto out_dtefac_release;
if (dtefacs.calling_len > X25_MAX_AE_LEN)
break;
goto out_dtefac_release;
if (dtefacs.calling_ae == NULL)
break;
goto out_dtefac_release;
if (dtefacs.called_len > X25_MAX_AE_LEN)
break;
goto out_dtefac_release;
if (dtefacs.called_ae == NULL)
break;
goto out_dtefac_release;
x25->dte_facilities = dtefacs;
rc = 0;
unlock_kernel();
out_dtefac_release:
release_sock(sk);
break;
}

Expand Down

0 comments on commit 44fef57

Please sign in to comment.