diff options
-rw-r--r-- | net/x25/af_x25.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 2518efae8ec..e2eea0aec46 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -1512,11 +1512,11 @@ out_dtefac_release: | |||
1512 | } | 1512 | } |
1513 | 1513 | ||
1514 | case SIOCX25GCALLUSERDATA: { | 1514 | case SIOCX25GCALLUSERDATA: { |
1515 | struct x25_calluserdata cud = x25->calluserdata; | 1515 | lock_sock(sk); |
1516 | lock_kernel(); | 1516 | rc = copy_to_user(argp, &x25->calluserdata, |
1517 | rc = copy_to_user(argp, &cud, | 1517 | sizeof(x25->calluserdata)) |
1518 | sizeof(cud)) ? -EFAULT : 0; | 1518 | ? -EFAULT : 0; |
1519 | unlock_kernel(); | 1519 | release_sock(sk); |
1520 | break; | 1520 | break; |
1521 | } | 1521 | } |
1522 | 1522 | ||
@@ -1524,15 +1524,15 @@ out_dtefac_release: | |||
1524 | struct x25_calluserdata calluserdata; | 1524 | struct x25_calluserdata calluserdata; |
1525 | 1525 | ||
1526 | rc = -EFAULT; | 1526 | rc = -EFAULT; |
1527 | lock_kernel(); | ||
1528 | if (copy_from_user(&calluserdata, argp, | 1527 | if (copy_from_user(&calluserdata, argp, |
1529 | sizeof(calluserdata))) | 1528 | sizeof(calluserdata))) |
1530 | break; | 1529 | break; |
1531 | rc = -EINVAL; | 1530 | rc = -EINVAL; |
1532 | if (calluserdata.cudlength > X25_MAX_CUD_LEN) | 1531 | if (calluserdata.cudlength > X25_MAX_CUD_LEN) |
1533 | break; | 1532 | break; |
1533 | lock_sock(sk); | ||
1534 | x25->calluserdata = calluserdata; | 1534 | x25->calluserdata = calluserdata; |
1535 | unlock_kernel(); | 1535 | release_sock(sk); |
1536 | rc = 0; | 1536 | rc = 0; |
1537 | break; | 1537 | break; |
1538 | } | 1538 | } |