diff options
| author | andrew hendry <andrew.hendry@gmail.com> | 2010-11-24 21:18:15 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-11-28 14:12:20 -0500 |
| commit | 5595a1a5997953dbd8c5df7c2f7d4b3a2eb2be4b (patch) | |
| tree | 56be68f4ddeae78c0751494264ffff88ce015304 | |
| parent | 5892b9e9ebdde50fbd524570d61ceb74f8be33f3 (diff) | |
X25 remove bkl in subscription ioctls
Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/net/x25.h | 2 | ||||
| -rw-r--r-- | net/x25/af_x25.c | 12 | ||||
| -rw-r--r-- | net/x25/x25_link.c | 8 |
3 files changed, 12 insertions, 10 deletions
diff --git a/include/net/x25.h b/include/net/x25.h index 1479cb4a41fc..a06119a05129 100644 --- a/include/net/x25.h +++ b/include/net/x25.h | |||
| @@ -315,6 +315,8 @@ extern struct list_head x25_route_list; | |||
| 315 | extern rwlock_t x25_route_list_lock; | 315 | extern rwlock_t x25_route_list_lock; |
| 316 | extern struct list_head x25_forward_list; | 316 | extern struct list_head x25_forward_list; |
| 317 | extern rwlock_t x25_forward_list_lock; | 317 | extern rwlock_t x25_forward_list_lock; |
| 318 | extern struct list_head x25_neigh_list; | ||
| 319 | extern rwlock_t x25_neigh_list_lock; | ||
| 318 | 320 | ||
| 319 | extern int x25_proc_init(void); | 321 | extern int x25_proc_init(void); |
| 320 | extern void x25_proc_exit(void); | 322 | extern void x25_proc_exit(void); |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 2351aceb296d..45be72c3f940 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
| @@ -1415,17 +1415,13 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
| 1415 | rc = x25_route_ioctl(cmd, argp); | 1415 | rc = x25_route_ioctl(cmd, argp); |
| 1416 | break; | 1416 | break; |
| 1417 | case SIOCX25GSUBSCRIP: | 1417 | case SIOCX25GSUBSCRIP: |
| 1418 | lock_kernel(); | ||
| 1419 | rc = x25_subscr_ioctl(cmd, argp); | 1418 | rc = x25_subscr_ioctl(cmd, argp); |
| 1420 | unlock_kernel(); | ||
| 1421 | break; | 1419 | break; |
| 1422 | case SIOCX25SSUBSCRIP: | 1420 | case SIOCX25SSUBSCRIP: |
| 1423 | rc = -EPERM; | 1421 | rc = -EPERM; |
| 1424 | if (!capable(CAP_NET_ADMIN)) | 1422 | if (!capable(CAP_NET_ADMIN)) |
| 1425 | break; | 1423 | break; |
| 1426 | lock_kernel(); | ||
| 1427 | rc = x25_subscr_ioctl(cmd, argp); | 1424 | rc = x25_subscr_ioctl(cmd, argp); |
| 1428 | unlock_kernel(); | ||
| 1429 | break; | 1425 | break; |
| 1430 | case SIOCX25GFACILITIES: { | 1426 | case SIOCX25GFACILITIES: { |
| 1431 | struct x25_facilities fac = x25->facilities; | 1427 | struct x25_facilities fac = x25->facilities; |
| @@ -1646,16 +1642,20 @@ static int compat_x25_subscr_ioctl(unsigned int cmd, | |||
| 1646 | dev_put(dev); | 1642 | dev_put(dev); |
| 1647 | 1643 | ||
| 1648 | if (cmd == SIOCX25GSUBSCRIP) { | 1644 | if (cmd == SIOCX25GSUBSCRIP) { |
| 1645 | read_lock_bh(&x25_neigh_list_lock); | ||
| 1649 | x25_subscr.extended = nb->extended; | 1646 | x25_subscr.extended = nb->extended; |
| 1650 | x25_subscr.global_facil_mask = nb->global_facil_mask; | 1647 | x25_subscr.global_facil_mask = nb->global_facil_mask; |
| 1648 | read_unlock_bh(&x25_neigh_list_lock); | ||
| 1651 | rc = copy_to_user(x25_subscr32, &x25_subscr, | 1649 | rc = copy_to_user(x25_subscr32, &x25_subscr, |
| 1652 | sizeof(*x25_subscr32)) ? -EFAULT : 0; | 1650 | sizeof(*x25_subscr32)) ? -EFAULT : 0; |
| 1653 | } else { | 1651 | } else { |
| 1654 | rc = -EINVAL; | 1652 | rc = -EINVAL; |
| 1655 | if (x25_subscr.extended == 0 || x25_subscr.extended == 1) { | 1653 | if (x25_subscr.extended == 0 || x25_subscr.extended == 1) { |
| 1656 | rc = 0; | 1654 | rc = 0; |
| 1655 | write_lock_bh(&x25_neigh_list_lock); | ||
| 1657 | nb->extended = x25_subscr.extended; | 1656 | nb->extended = x25_subscr.extended; |
| 1658 | nb->global_facil_mask = x25_subscr.global_facil_mask; | 1657 | nb->global_facil_mask = x25_subscr.global_facil_mask; |
| 1658 | write_unlock_bh(&x25_neigh_list_lock); | ||
| 1659 | } | 1659 | } |
| 1660 | } | 1660 | } |
| 1661 | x25_neigh_put(nb); | 1661 | x25_neigh_put(nb); |
| @@ -1711,17 +1711,13 @@ static int compat_x25_ioctl(struct socket *sock, unsigned int cmd, | |||
| 1711 | rc = x25_route_ioctl(cmd, argp); | 1711 | rc = x25_route_ioctl(cmd, argp); |
| 1712 | break; | 1712 | break; |
| 1713 | case SIOCX25GSUBSCRIP: | 1713 | case SIOCX25GSUBSCRIP: |
| 1714 | lock_kernel(); | ||
| 1715 | rc = compat_x25_subscr_ioctl(cmd, argp); | 1714 | rc = compat_x25_subscr_ioctl(cmd, argp); |
| 1716 | unlock_kernel(); | ||
| 1717 | break; | 1715 | break; |
| 1718 | case SIOCX25SSUBSCRIP: | 1716 | case SIOCX25SSUBSCRIP: |
| 1719 | rc = -EPERM; | 1717 | rc = -EPERM; |
| 1720 | if (!capable(CAP_NET_ADMIN)) | 1718 | if (!capable(CAP_NET_ADMIN)) |
| 1721 | break; | 1719 | break; |
| 1722 | lock_kernel(); | ||
| 1723 | rc = compat_x25_subscr_ioctl(cmd, argp); | 1720 | rc = compat_x25_subscr_ioctl(cmd, argp); |
| 1724 | unlock_kernel(); | ||
| 1725 | break; | 1721 | break; |
| 1726 | case SIOCX25GFACILITIES: | 1722 | case SIOCX25GFACILITIES: |
| 1727 | case SIOCX25SFACILITIES: | 1723 | case SIOCX25SFACILITIES: |
diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index 73e7b954ad28..4c81f6abb65b 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c | |||
| @@ -31,8 +31,8 @@ | |||
| 31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
| 32 | #include <net/x25.h> | 32 | #include <net/x25.h> |
| 33 | 33 | ||
| 34 | static LIST_HEAD(x25_neigh_list); | 34 | LIST_HEAD(x25_neigh_list); |
| 35 | static DEFINE_RWLOCK(x25_neigh_list_lock); | 35 | DEFINE_RWLOCK(x25_neigh_list_lock); |
| 36 | 36 | ||
| 37 | static void x25_t20timer_expiry(unsigned long); | 37 | static void x25_t20timer_expiry(unsigned long); |
| 38 | 38 | ||
| @@ -360,16 +360,20 @@ int x25_subscr_ioctl(unsigned int cmd, void __user *arg) | |||
| 360 | dev_put(dev); | 360 | dev_put(dev); |
| 361 | 361 | ||
| 362 | if (cmd == SIOCX25GSUBSCRIP) { | 362 | if (cmd == SIOCX25GSUBSCRIP) { |
| 363 | read_lock_bh(&x25_neigh_list_lock); | ||
| 363 | x25_subscr.extended = nb->extended; | 364 | x25_subscr.extended = nb->extended; |
| 364 | x25_subscr.global_facil_mask = nb->global_facil_mask; | 365 | x25_subscr.global_facil_mask = nb->global_facil_mask; |
| 366 | read_unlock_bh(&x25_neigh_list_lock); | ||
| 365 | rc = copy_to_user(arg, &x25_subscr, | 367 | rc = copy_to_user(arg, &x25_subscr, |
| 366 | sizeof(x25_subscr)) ? -EFAULT : 0; | 368 | sizeof(x25_subscr)) ? -EFAULT : 0; |
| 367 | } else { | 369 | } else { |
| 368 | rc = -EINVAL; | 370 | rc = -EINVAL; |
| 369 | if (!(x25_subscr.extended && x25_subscr.extended != 1)) { | 371 | if (!(x25_subscr.extended && x25_subscr.extended != 1)) { |
| 370 | rc = 0; | 372 | rc = 0; |
| 373 | write_lock_bh(&x25_neigh_list_lock); | ||
| 371 | nb->extended = x25_subscr.extended; | 374 | nb->extended = x25_subscr.extended; |
| 372 | nb->global_facil_mask = x25_subscr.global_facil_mask; | 375 | nb->global_facil_mask = x25_subscr.global_facil_mask; |
| 376 | write_unlock_bh(&x25_neigh_list_lock); | ||
| 373 | } | 377 | } |
| 374 | } | 378 | } |
| 375 | x25_neigh_put(nb); | 379 | x25_neigh_put(nb); |
