diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/compat_ioctl.c | 114 | ||||
| -rw-r--r-- | fs/configfs/dir.c | 28 | ||||
| -rw-r--r-- | fs/dlm/config.c | 45 | ||||
| -rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 19 | ||||
| -rw-r--r-- | fs/ocfs2/cluster/nodemanager.c | 49 | ||||
| -rw-r--r-- | fs/proc/proc_net.c | 32 | ||||
| -rw-r--r-- | fs/proc/proc_tty.c | 48 |
7 files changed, 89 insertions, 246 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index c54eaab71a19..7b3a03c7c6a9 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | #include <linux/syscalls.h> | 58 | #include <linux/syscalls.h> |
| 59 | #include <linux/i2c.h> | 59 | #include <linux/i2c.h> |
| 60 | #include <linux/i2c-dev.h> | 60 | #include <linux/i2c-dev.h> |
| 61 | #include <linux/wireless.h> | ||
| 62 | #include <linux/atalk.h> | 61 | #include <linux/atalk.h> |
| 63 | #include <linux/loop.h> | 62 | #include <linux/loop.h> |
| 64 | 63 | ||
| @@ -1759,64 +1758,6 @@ static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, unsigned long a | |||
| 1759 | return sys_ioctl(fd, cmd, (unsigned long)tdata); | 1758 | return sys_ioctl(fd, cmd, (unsigned long)tdata); |
| 1760 | } | 1759 | } |
| 1761 | 1760 | ||
| 1762 | struct compat_iw_point { | ||
| 1763 | compat_caddr_t pointer; | ||
| 1764 | __u16 length; | ||
| 1765 | __u16 flags; | ||
| 1766 | }; | ||
| 1767 | |||
| 1768 | static int do_wireless_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 1769 | { | ||
| 1770 | struct iwreq __user *iwr; | ||
| 1771 | struct iwreq __user *iwr_u; | ||
| 1772 | struct iw_point __user *iwp; | ||
| 1773 | struct compat_iw_point __user *iwp_u; | ||
| 1774 | compat_caddr_t pointer_u; | ||
| 1775 | void __user *pointer; | ||
| 1776 | __u16 length, flags; | ||
| 1777 | int ret; | ||
| 1778 | |||
| 1779 | iwr_u = compat_ptr(arg); | ||
| 1780 | iwp_u = (struct compat_iw_point __user *) &iwr_u->u.data; | ||
| 1781 | iwr = compat_alloc_user_space(sizeof(*iwr)); | ||
| 1782 | if (iwr == NULL) | ||
| 1783 | return -ENOMEM; | ||
| 1784 | |||
| 1785 | iwp = &iwr->u.data; | ||
| 1786 | |||
| 1787 | if (!access_ok(VERIFY_WRITE, iwr, sizeof(*iwr))) | ||
| 1788 | return -EFAULT; | ||
| 1789 | |||
| 1790 | if (__copy_in_user(&iwr->ifr_ifrn.ifrn_name[0], | ||
| 1791 | &iwr_u->ifr_ifrn.ifrn_name[0], | ||
| 1792 | sizeof(iwr->ifr_ifrn.ifrn_name))) | ||
| 1793 | return -EFAULT; | ||
| 1794 | |||
| 1795 | if (__get_user(pointer_u, &iwp_u->pointer) || | ||
| 1796 | __get_user(length, &iwp_u->length) || | ||
| 1797 | __get_user(flags, &iwp_u->flags)) | ||
| 1798 | return -EFAULT; | ||
| 1799 | |||
| 1800 | if (__put_user(compat_ptr(pointer_u), &iwp->pointer) || | ||
| 1801 | __put_user(length, &iwp->length) || | ||
| 1802 | __put_user(flags, &iwp->flags)) | ||
| 1803 | return -EFAULT; | ||
| 1804 | |||
| 1805 | ret = sys_ioctl(fd, cmd, (unsigned long) iwr); | ||
| 1806 | |||
| 1807 | if (__get_user(pointer, &iwp->pointer) || | ||
| 1808 | __get_user(length, &iwp->length) || | ||
| 1809 | __get_user(flags, &iwp->flags)) | ||
| 1810 | return -EFAULT; | ||
| 1811 | |||
| 1812 | if (__put_user(ptr_to_compat(pointer), &iwp_u->pointer) || | ||
| 1813 | __put_user(length, &iwp_u->length) || | ||
| 1814 | __put_user(flags, &iwp_u->flags)) | ||
| 1815 | return -EFAULT; | ||
| 1816 | |||
| 1817 | return ret; | ||
| 1818 | } | ||
| 1819 | |||
| 1820 | /* Since old style bridge ioctl's endup using SIOCDEVPRIVATE | 1761 | /* Since old style bridge ioctl's endup using SIOCDEVPRIVATE |
| 1821 | * for some operations; this forces use of the newer bridge-utils that | 1762 | * for some operations; this forces use of the newer bridge-utils that |
| 1822 | * use compatiable ioctls | 1763 | * use compatiable ioctls |
| @@ -2405,6 +2346,7 @@ COMPATIBLE_IOCTL(HCIGETDEVLIST) | |||
| 2405 | COMPATIBLE_IOCTL(HCIGETDEVINFO) | 2346 | COMPATIBLE_IOCTL(HCIGETDEVINFO) |
| 2406 | COMPATIBLE_IOCTL(HCIGETCONNLIST) | 2347 | COMPATIBLE_IOCTL(HCIGETCONNLIST) |
| 2407 | COMPATIBLE_IOCTL(HCIGETCONNINFO) | 2348 | COMPATIBLE_IOCTL(HCIGETCONNINFO) |
| 2349 | COMPATIBLE_IOCTL(HCIGETAUTHINFO) | ||
| 2408 | COMPATIBLE_IOCTL(HCISETRAW) | 2350 | COMPATIBLE_IOCTL(HCISETRAW) |
| 2409 | COMPATIBLE_IOCTL(HCISETSCAN) | 2351 | COMPATIBLE_IOCTL(HCISETSCAN) |
| 2410 | COMPATIBLE_IOCTL(HCISETAUTH) | 2352 | COMPATIBLE_IOCTL(HCISETAUTH) |
| @@ -2501,36 +2443,6 @@ COMPATIBLE_IOCTL(I2C_TENBIT) | |||
| 2501 | COMPATIBLE_IOCTL(I2C_PEC) | 2443 | COMPATIBLE_IOCTL(I2C_PEC) |
| 2502 | COMPATIBLE_IOCTL(I2C_RETRIES) | 2444 | COMPATIBLE_IOCTL(I2C_RETRIES) |
| 2503 | COMPATIBLE_IOCTL(I2C_TIMEOUT) | 2445 | COMPATIBLE_IOCTL(I2C_TIMEOUT) |
| 2504 | /* wireless */ | ||
| 2505 | COMPATIBLE_IOCTL(SIOCSIWCOMMIT) | ||
| 2506 | COMPATIBLE_IOCTL(SIOCGIWNAME) | ||
| 2507 | COMPATIBLE_IOCTL(SIOCSIWNWID) | ||
| 2508 | COMPATIBLE_IOCTL(SIOCGIWNWID) | ||
| 2509 | COMPATIBLE_IOCTL(SIOCSIWFREQ) | ||
| 2510 | COMPATIBLE_IOCTL(SIOCGIWFREQ) | ||
| 2511 | COMPATIBLE_IOCTL(SIOCSIWMODE) | ||
| 2512 | COMPATIBLE_IOCTL(SIOCGIWMODE) | ||
| 2513 | COMPATIBLE_IOCTL(SIOCSIWSENS) | ||
| 2514 | COMPATIBLE_IOCTL(SIOCGIWSENS) | ||
| 2515 | COMPATIBLE_IOCTL(SIOCSIWRANGE) | ||
| 2516 | COMPATIBLE_IOCTL(SIOCSIWPRIV) | ||
| 2517 | COMPATIBLE_IOCTL(SIOCSIWSTATS) | ||
| 2518 | COMPATIBLE_IOCTL(SIOCSIWAP) | ||
| 2519 | COMPATIBLE_IOCTL(SIOCGIWAP) | ||
| 2520 | COMPATIBLE_IOCTL(SIOCSIWRATE) | ||
| 2521 | COMPATIBLE_IOCTL(SIOCGIWRATE) | ||
| 2522 | COMPATIBLE_IOCTL(SIOCSIWRTS) | ||
| 2523 | COMPATIBLE_IOCTL(SIOCGIWRTS) | ||
| 2524 | COMPATIBLE_IOCTL(SIOCSIWFRAG) | ||
| 2525 | COMPATIBLE_IOCTL(SIOCGIWFRAG) | ||
| 2526 | COMPATIBLE_IOCTL(SIOCSIWTXPOW) | ||
| 2527 | COMPATIBLE_IOCTL(SIOCGIWTXPOW) | ||
| 2528 | COMPATIBLE_IOCTL(SIOCSIWRETRY) | ||
| 2529 | COMPATIBLE_IOCTL(SIOCGIWRETRY) | ||
| 2530 | COMPATIBLE_IOCTL(SIOCSIWPOWER) | ||
| 2531 | COMPATIBLE_IOCTL(SIOCGIWPOWER) | ||
| 2532 | COMPATIBLE_IOCTL(SIOCSIWAUTH) | ||
| 2533 | COMPATIBLE_IOCTL(SIOCGIWAUTH) | ||
| 2534 | /* hiddev */ | 2446 | /* hiddev */ |
| 2535 | COMPATIBLE_IOCTL(HIDIOCGVERSION) | 2447 | COMPATIBLE_IOCTL(HIDIOCGVERSION) |
| 2536 | COMPATIBLE_IOCTL(HIDIOCAPPLICATION) | 2448 | COMPATIBLE_IOCTL(HIDIOCAPPLICATION) |
| @@ -2761,29 +2673,7 @@ COMPATIBLE_IOCTL(USBDEVFS_IOCTL32) | |||
| 2761 | HANDLE_IOCTL(I2C_FUNCS, w_long) | 2673 | HANDLE_IOCTL(I2C_FUNCS, w_long) |
| 2762 | HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl) | 2674 | HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl) |
| 2763 | HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl) | 2675 | HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl) |
| 2764 | /* wireless */ | 2676 | /* bridge */ |
| 2765 | HANDLE_IOCTL(SIOCGIWRANGE, do_wireless_ioctl) | ||
| 2766 | HANDLE_IOCTL(SIOCGIWPRIV, do_wireless_ioctl) | ||
| 2767 | HANDLE_IOCTL(SIOCGIWSTATS, do_wireless_ioctl) | ||
| 2768 | HANDLE_IOCTL(SIOCSIWSPY, do_wireless_ioctl) | ||
| 2769 | HANDLE_IOCTL(SIOCGIWSPY, do_wireless_ioctl) | ||
| 2770 | HANDLE_IOCTL(SIOCSIWTHRSPY, do_wireless_ioctl) | ||
| 2771 | HANDLE_IOCTL(SIOCGIWTHRSPY, do_wireless_ioctl) | ||
| 2772 | HANDLE_IOCTL(SIOCSIWMLME, do_wireless_ioctl) | ||
| 2773 | HANDLE_IOCTL(SIOCGIWAPLIST, do_wireless_ioctl) | ||
| 2774 | HANDLE_IOCTL(SIOCSIWSCAN, do_wireless_ioctl) | ||
| 2775 | HANDLE_IOCTL(SIOCGIWSCAN, do_wireless_ioctl) | ||
| 2776 | HANDLE_IOCTL(SIOCSIWESSID, do_wireless_ioctl) | ||
| 2777 | HANDLE_IOCTL(SIOCGIWESSID, do_wireless_ioctl) | ||
| 2778 | HANDLE_IOCTL(SIOCSIWNICKN, do_wireless_ioctl) | ||
| 2779 | HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl) | ||
| 2780 | HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl) | ||
| 2781 | HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl) | ||
| 2782 | HANDLE_IOCTL(SIOCSIWGENIE, do_wireless_ioctl) | ||
| 2783 | HANDLE_IOCTL(SIOCGIWGENIE, do_wireless_ioctl) | ||
| 2784 | HANDLE_IOCTL(SIOCSIWENCODEEXT, do_wireless_ioctl) | ||
| 2785 | HANDLE_IOCTL(SIOCGIWENCODEEXT, do_wireless_ioctl) | ||
| 2786 | HANDLE_IOCTL(SIOCSIWPMKSA, do_wireless_ioctl) | ||
| 2787 | HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) | 2677 | HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) |
| 2788 | HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) | 2678 | HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) |
| 2789 | /* Not implemented in the native kernel */ | 2679 | /* Not implemented in the native kernel */ |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 0e64312a084c..179589be063a 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
| @@ -1027,9 +1027,10 @@ EXPORT_SYMBOL(configfs_undepend_item); | |||
| 1027 | 1027 | ||
| 1028 | static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 1028 | static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) |
| 1029 | { | 1029 | { |
| 1030 | int ret, module_got = 0; | 1030 | int ret = 0; |
| 1031 | struct config_group *group; | 1031 | int module_got = 0; |
| 1032 | struct config_item *item; | 1032 | struct config_group *group = NULL; |
| 1033 | struct config_item *item = NULL; | ||
| 1033 | struct config_item *parent_item; | 1034 | struct config_item *parent_item; |
| 1034 | struct configfs_subsystem *subsys; | 1035 | struct configfs_subsystem *subsys; |
| 1035 | struct configfs_dirent *sd; | 1036 | struct configfs_dirent *sd; |
| @@ -1070,25 +1071,30 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
| 1070 | snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name); | 1071 | snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name); |
| 1071 | 1072 | ||
| 1072 | mutex_lock(&subsys->su_mutex); | 1073 | mutex_lock(&subsys->su_mutex); |
| 1073 | group = NULL; | ||
| 1074 | item = NULL; | ||
| 1075 | if (type->ct_group_ops->make_group) { | 1074 | if (type->ct_group_ops->make_group) { |
| 1076 | ret = type->ct_group_ops->make_group(to_config_group(parent_item), name, &group); | 1075 | group = type->ct_group_ops->make_group(to_config_group(parent_item), name); |
| 1077 | if (!ret) { | 1076 | if (!group) |
| 1077 | group = ERR_PTR(-ENOMEM); | ||
| 1078 | if (!IS_ERR(group)) { | ||
| 1078 | link_group(to_config_group(parent_item), group); | 1079 | link_group(to_config_group(parent_item), group); |
| 1079 | item = &group->cg_item; | 1080 | item = &group->cg_item; |
| 1080 | } | 1081 | } else |
| 1082 | ret = PTR_ERR(group); | ||
| 1081 | } else { | 1083 | } else { |
| 1082 | ret = type->ct_group_ops->make_item(to_config_group(parent_item), name, &item); | 1084 | item = type->ct_group_ops->make_item(to_config_group(parent_item), name); |
| 1083 | if (!ret) | 1085 | if (!item) |
| 1086 | item = ERR_PTR(-ENOMEM); | ||
| 1087 | if (!IS_ERR(item)) | ||
| 1084 | link_obj(parent_item, item); | 1088 | link_obj(parent_item, item); |
| 1089 | else | ||
| 1090 | ret = PTR_ERR(item); | ||
| 1085 | } | 1091 | } |
| 1086 | mutex_unlock(&subsys->su_mutex); | 1092 | mutex_unlock(&subsys->su_mutex); |
| 1087 | 1093 | ||
| 1088 | kfree(name); | 1094 | kfree(name); |
| 1089 | if (ret) { | 1095 | if (ret) { |
| 1090 | /* | 1096 | /* |
| 1091 | * If ret != 0, then link_obj() was never called. | 1097 | * If item == NULL, then link_obj() was never called. |
| 1092 | * There are no extra references to clean up. | 1098 | * There are no extra references to clean up. |
| 1093 | */ | 1099 | */ |
| 1094 | goto out_put; | 1100 | goto out_put; |
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index 492d8caaaf25..c4e7d721bd8d 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
| @@ -41,20 +41,16 @@ struct comm; | |||
| 41 | struct nodes; | 41 | struct nodes; |
| 42 | struct node; | 42 | struct node; |
| 43 | 43 | ||
| 44 | static int make_cluster(struct config_group *, const char *, | 44 | static struct config_group *make_cluster(struct config_group *, const char *); |
| 45 | struct config_group **); | ||
| 46 | static void drop_cluster(struct config_group *, struct config_item *); | 45 | static void drop_cluster(struct config_group *, struct config_item *); |
| 47 | static void release_cluster(struct config_item *); | 46 | static void release_cluster(struct config_item *); |
| 48 | static int make_space(struct config_group *, const char *, | 47 | static struct config_group *make_space(struct config_group *, const char *); |
| 49 | struct config_group **); | ||
| 50 | static void drop_space(struct config_group *, struct config_item *); | 48 | static void drop_space(struct config_group *, struct config_item *); |
| 51 | static void release_space(struct config_item *); | 49 | static void release_space(struct config_item *); |
| 52 | static int make_comm(struct config_group *, const char *, | 50 | static struct config_item *make_comm(struct config_group *, const char *); |
| 53 | struct config_item **); | ||
| 54 | static void drop_comm(struct config_group *, struct config_item *); | 51 | static void drop_comm(struct config_group *, struct config_item *); |
| 55 | static void release_comm(struct config_item *); | 52 | static void release_comm(struct config_item *); |
| 56 | static int make_node(struct config_group *, const char *, | 53 | static struct config_item *make_node(struct config_group *, const char *); |
| 57 | struct config_item **); | ||
| 58 | static void drop_node(struct config_group *, struct config_item *); | 54 | static void drop_node(struct config_group *, struct config_item *); |
| 59 | static void release_node(struct config_item *); | 55 | static void release_node(struct config_item *); |
| 60 | 56 | ||
| @@ -396,8 +392,8 @@ static struct node *to_node(struct config_item *i) | |||
| 396 | return i ? container_of(i, struct node, item) : NULL; | 392 | return i ? container_of(i, struct node, item) : NULL; |
| 397 | } | 393 | } |
| 398 | 394 | ||
| 399 | static int make_cluster(struct config_group *g, const char *name, | 395 | static struct config_group *make_cluster(struct config_group *g, |
| 400 | struct config_group **new_g) | 396 | const char *name) |
| 401 | { | 397 | { |
| 402 | struct cluster *cl = NULL; | 398 | struct cluster *cl = NULL; |
| 403 | struct spaces *sps = NULL; | 399 | struct spaces *sps = NULL; |
| @@ -435,15 +431,14 @@ static int make_cluster(struct config_group *g, const char *name, | |||
| 435 | 431 | ||
| 436 | space_list = &sps->ss_group; | 432 | space_list = &sps->ss_group; |
| 437 | comm_list = &cms->cs_group; | 433 | comm_list = &cms->cs_group; |
| 438 | *new_g = &cl->group; | 434 | return &cl->group; |
| 439 | return 0; | ||
| 440 | 435 | ||
| 441 | fail: | 436 | fail: |
| 442 | kfree(cl); | 437 | kfree(cl); |
| 443 | kfree(gps); | 438 | kfree(gps); |
| 444 | kfree(sps); | 439 | kfree(sps); |
| 445 | kfree(cms); | 440 | kfree(cms); |
| 446 | return -ENOMEM; | 441 | return ERR_PTR(-ENOMEM); |
| 447 | } | 442 | } |
| 448 | 443 | ||
| 449 | static void drop_cluster(struct config_group *g, struct config_item *i) | 444 | static void drop_cluster(struct config_group *g, struct config_item *i) |
| @@ -471,8 +466,7 @@ static void release_cluster(struct config_item *i) | |||
| 471 | kfree(cl); | 466 | kfree(cl); |
| 472 | } | 467 | } |
| 473 | 468 | ||
| 474 | static int make_space(struct config_group *g, const char *name, | 469 | static struct config_group *make_space(struct config_group *g, const char *name) |
| 475 | struct config_group **new_g) | ||
| 476 | { | 470 | { |
| 477 | struct space *sp = NULL; | 471 | struct space *sp = NULL; |
| 478 | struct nodes *nds = NULL; | 472 | struct nodes *nds = NULL; |
| @@ -495,14 +489,13 @@ static int make_space(struct config_group *g, const char *name, | |||
| 495 | INIT_LIST_HEAD(&sp->members); | 489 | INIT_LIST_HEAD(&sp->members); |
| 496 | mutex_init(&sp->members_lock); | 490 | mutex_init(&sp->members_lock); |
| 497 | sp->members_count = 0; | 491 | sp->members_count = 0; |
| 498 | *new_g = &sp->group; | 492 | return &sp->group; |
| 499 | return 0; | ||
| 500 | 493 | ||
| 501 | fail: | 494 | fail: |
| 502 | kfree(sp); | 495 | kfree(sp); |
| 503 | kfree(gps); | 496 | kfree(gps); |
| 504 | kfree(nds); | 497 | kfree(nds); |
| 505 | return -ENOMEM; | 498 | return ERR_PTR(-ENOMEM); |
| 506 | } | 499 | } |
| 507 | 500 | ||
| 508 | static void drop_space(struct config_group *g, struct config_item *i) | 501 | static void drop_space(struct config_group *g, struct config_item *i) |
| @@ -529,21 +522,19 @@ static void release_space(struct config_item *i) | |||
| 529 | kfree(sp); | 522 | kfree(sp); |
| 530 | } | 523 | } |
| 531 | 524 | ||
| 532 | static int make_comm(struct config_group *g, const char *name, | 525 | static struct config_item *make_comm(struct config_group *g, const char *name) |
| 533 | struct config_item **new_i) | ||
| 534 | { | 526 | { |
| 535 | struct comm *cm; | 527 | struct comm *cm; |
| 536 | 528 | ||
| 537 | cm = kzalloc(sizeof(struct comm), GFP_KERNEL); | 529 | cm = kzalloc(sizeof(struct comm), GFP_KERNEL); |
| 538 | if (!cm) | 530 | if (!cm) |
| 539 | return -ENOMEM; | 531 | return ERR_PTR(-ENOMEM); |
| 540 | 532 | ||
| 541 | config_item_init_type_name(&cm->item, name, &comm_type); | 533 | config_item_init_type_name(&cm->item, name, &comm_type); |
| 542 | cm->nodeid = -1; | 534 | cm->nodeid = -1; |
| 543 | cm->local = 0; | 535 | cm->local = 0; |
| 544 | cm->addr_count = 0; | 536 | cm->addr_count = 0; |
| 545 | *new_i = &cm->item; | 537 | return &cm->item; |
| 546 | return 0; | ||
| 547 | } | 538 | } |
| 548 | 539 | ||
| 549 | static void drop_comm(struct config_group *g, struct config_item *i) | 540 | static void drop_comm(struct config_group *g, struct config_item *i) |
| @@ -563,15 +554,14 @@ static void release_comm(struct config_item *i) | |||
| 563 | kfree(cm); | 554 | kfree(cm); |
| 564 | } | 555 | } |
| 565 | 556 | ||
| 566 | static int make_node(struct config_group *g, const char *name, | 557 | static struct config_item *make_node(struct config_group *g, const char *name) |
| 567 | struct config_item **new_i) | ||
| 568 | { | 558 | { |
| 569 | struct space *sp = to_space(g->cg_item.ci_parent); | 559 | struct space *sp = to_space(g->cg_item.ci_parent); |
| 570 | struct node *nd; | 560 | struct node *nd; |
| 571 | 561 | ||
| 572 | nd = kzalloc(sizeof(struct node), GFP_KERNEL); | 562 | nd = kzalloc(sizeof(struct node), GFP_KERNEL); |
| 573 | if (!nd) | 563 | if (!nd) |
| 574 | return -ENOMEM; | 564 | return ERR_PTR(-ENOMEM); |
| 575 | 565 | ||
| 576 | config_item_init_type_name(&nd->item, name, &node_type); | 566 | config_item_init_type_name(&nd->item, name, &node_type); |
| 577 | nd->nodeid = -1; | 567 | nd->nodeid = -1; |
| @@ -583,8 +573,7 @@ static int make_node(struct config_group *g, const char *name, | |||
| 583 | sp->members_count++; | 573 | sp->members_count++; |
| 584 | mutex_unlock(&sp->members_lock); | 574 | mutex_unlock(&sp->members_lock); |
| 585 | 575 | ||
| 586 | *new_i = &nd->item; | 576 | return &nd->item; |
| 587 | return 0; | ||
| 588 | } | 577 | } |
| 589 | 578 | ||
| 590 | static void drop_node(struct config_group *g, struct config_item *i) | 579 | static void drop_node(struct config_group *g, struct config_item *i) |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 443d108211ab..7dce1612553e 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
| @@ -1489,31 +1489,22 @@ static struct o2hb_heartbeat_group *to_o2hb_heartbeat_group(struct config_group | |||
| 1489 | : NULL; | 1489 | : NULL; |
| 1490 | } | 1490 | } |
| 1491 | 1491 | ||
| 1492 | static int o2hb_heartbeat_group_make_item(struct config_group *group, | 1492 | static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *group, |
| 1493 | const char *name, | 1493 | const char *name) |
| 1494 | struct config_item **new_item) | ||
| 1495 | { | 1494 | { |
| 1496 | struct o2hb_region *reg = NULL; | 1495 | struct o2hb_region *reg = NULL; |
| 1497 | int ret = 0; | ||
| 1498 | 1496 | ||
| 1499 | reg = kzalloc(sizeof(struct o2hb_region), GFP_KERNEL); | 1497 | reg = kzalloc(sizeof(struct o2hb_region), GFP_KERNEL); |
| 1500 | if (reg == NULL) { | 1498 | if (reg == NULL) |
| 1501 | ret = -ENOMEM; | 1499 | return ERR_PTR(-ENOMEM); |
| 1502 | goto out; | ||
| 1503 | } | ||
| 1504 | 1500 | ||
| 1505 | config_item_init_type_name(®->hr_item, name, &o2hb_region_type); | 1501 | config_item_init_type_name(®->hr_item, name, &o2hb_region_type); |
| 1506 | 1502 | ||
| 1507 | *new_item = ®->hr_item; | ||
| 1508 | |||
| 1509 | spin_lock(&o2hb_live_lock); | 1503 | spin_lock(&o2hb_live_lock); |
| 1510 | list_add_tail(®->hr_all_item, &o2hb_all_regions); | 1504 | list_add_tail(®->hr_all_item, &o2hb_all_regions); |
| 1511 | spin_unlock(&o2hb_live_lock); | 1505 | spin_unlock(&o2hb_live_lock); |
| 1512 | out: | ||
| 1513 | if (ret) | ||
| 1514 | kfree(reg); | ||
| 1515 | 1506 | ||
| 1516 | return ret; | 1507 | return ®->hr_item; |
| 1517 | } | 1508 | } |
| 1518 | 1509 | ||
| 1519 | static void o2hb_heartbeat_group_drop_item(struct config_group *group, | 1510 | static void o2hb_heartbeat_group_drop_item(struct config_group *group, |
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index b364b7052e46..816a3f61330c 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c | |||
| @@ -644,35 +644,23 @@ out: | |||
| 644 | return ret; | 644 | return ret; |
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | static int o2nm_node_group_make_item(struct config_group *group, | 647 | static struct config_item *o2nm_node_group_make_item(struct config_group *group, |
| 648 | const char *name, | 648 | const char *name) |
| 649 | struct config_item **new_item) | ||
| 650 | { | 649 | { |
| 651 | struct o2nm_node *node = NULL; | 650 | struct o2nm_node *node = NULL; |
| 652 | int ret = 0; | ||
| 653 | 651 | ||
| 654 | if (strlen(name) > O2NM_MAX_NAME_LEN) { | 652 | if (strlen(name) > O2NM_MAX_NAME_LEN) |
| 655 | ret = -ENAMETOOLONG; | 653 | return ERR_PTR(-ENAMETOOLONG); |
| 656 | goto out; | ||
| 657 | } | ||
| 658 | 654 | ||
| 659 | node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL); | 655 | node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL); |
| 660 | if (node == NULL) { | 656 | if (node == NULL) |
| 661 | ret = -ENOMEM; | 657 | return ERR_PTR(-ENOMEM); |
| 662 | goto out; | ||
| 663 | } | ||
| 664 | 658 | ||
| 665 | strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */ | 659 | strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */ |
| 666 | config_item_init_type_name(&node->nd_item, name, &o2nm_node_type); | 660 | config_item_init_type_name(&node->nd_item, name, &o2nm_node_type); |
| 667 | spin_lock_init(&node->nd_lock); | 661 | spin_lock_init(&node->nd_lock); |
| 668 | 662 | ||
| 669 | *new_item = &node->nd_item; | 663 | return &node->nd_item; |
| 670 | |||
| 671 | out: | ||
| 672 | if (ret) | ||
| 673 | kfree(node); | ||
| 674 | |||
| 675 | return ret; | ||
| 676 | } | 664 | } |
| 677 | 665 | ||
| 678 | static void o2nm_node_group_drop_item(struct config_group *group, | 666 | static void o2nm_node_group_drop_item(struct config_group *group, |
| @@ -756,31 +744,25 @@ static struct o2nm_cluster_group *to_o2nm_cluster_group(struct config_group *gro | |||
| 756 | } | 744 | } |
| 757 | #endif | 745 | #endif |
| 758 | 746 | ||
| 759 | static int o2nm_cluster_group_make_group(struct config_group *group, | 747 | static struct config_group *o2nm_cluster_group_make_group(struct config_group *group, |
| 760 | const char *name, | 748 | const char *name) |
| 761 | struct config_group **new_group) | ||
| 762 | { | 749 | { |
| 763 | struct o2nm_cluster *cluster = NULL; | 750 | struct o2nm_cluster *cluster = NULL; |
| 764 | struct o2nm_node_group *ns = NULL; | 751 | struct o2nm_node_group *ns = NULL; |
| 765 | struct config_group *o2hb_group = NULL; | 752 | struct config_group *o2hb_group = NULL, *ret = NULL; |
| 766 | void *defs = NULL; | 753 | void *defs = NULL; |
| 767 | int ret = 0; | ||
| 768 | 754 | ||
| 769 | /* this runs under the parent dir's i_mutex; there can be only | 755 | /* this runs under the parent dir's i_mutex; there can be only |
| 770 | * one caller in here at a time */ | 756 | * one caller in here at a time */ |
| 771 | if (o2nm_single_cluster) { | 757 | if (o2nm_single_cluster) |
| 772 | ret = -ENOSPC; | 758 | return ERR_PTR(-ENOSPC); |
| 773 | goto out; | ||
| 774 | } | ||
| 775 | 759 | ||
| 776 | cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL); | 760 | cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL); |
| 777 | ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL); | 761 | ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL); |
| 778 | defs = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL); | 762 | defs = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL); |
| 779 | o2hb_group = o2hb_alloc_hb_set(); | 763 | o2hb_group = o2hb_alloc_hb_set(); |
| 780 | if (cluster == NULL || ns == NULL || o2hb_group == NULL || defs == NULL) { | 764 | if (cluster == NULL || ns == NULL || o2hb_group == NULL || defs == NULL) |
| 781 | ret = -ENOMEM; | ||
| 782 | goto out; | 765 | goto out; |
| 783 | } | ||
| 784 | 766 | ||
| 785 | config_group_init_type_name(&cluster->cl_group, name, | 767 | config_group_init_type_name(&cluster->cl_group, name, |
| 786 | &o2nm_cluster_type); | 768 | &o2nm_cluster_type); |
| @@ -797,15 +779,16 @@ static int o2nm_cluster_group_make_group(struct config_group *group, | |||
| 797 | cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; | 779 | cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; |
| 798 | cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; | 780 | cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; |
| 799 | 781 | ||
| 800 | *new_group = &cluster->cl_group; | 782 | ret = &cluster->cl_group; |
| 801 | o2nm_single_cluster = cluster; | 783 | o2nm_single_cluster = cluster; |
| 802 | 784 | ||
| 803 | out: | 785 | out: |
| 804 | if (ret) { | 786 | if (ret == NULL) { |
| 805 | kfree(cluster); | 787 | kfree(cluster); |
| 806 | kfree(ns); | 788 | kfree(ns); |
| 807 | o2hb_free_hb_set(o2hb_group); | 789 | o2hb_free_hb_set(o2hb_group); |
| 808 | kfree(defs); | 790 | kfree(defs); |
| 791 | ret = ERR_PTR(-ENOMEM); | ||
| 809 | } | 792 | } |
| 810 | 793 | ||
| 811 | return ret; | 794 | return ret; |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index 83f357b30d71..b224a28e0c15 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
| @@ -51,6 +51,30 @@ int seq_open_net(struct inode *ino, struct file *f, | |||
| 51 | } | 51 | } |
| 52 | EXPORT_SYMBOL_GPL(seq_open_net); | 52 | EXPORT_SYMBOL_GPL(seq_open_net); |
| 53 | 53 | ||
| 54 | int single_open_net(struct inode *inode, struct file *file, | ||
| 55 | int (*show)(struct seq_file *, void *)) | ||
| 56 | { | ||
| 57 | int err; | ||
| 58 | struct net *net; | ||
| 59 | |||
| 60 | err = -ENXIO; | ||
| 61 | net = get_proc_net(inode); | ||
| 62 | if (net == NULL) | ||
| 63 | goto err_net; | ||
| 64 | |||
| 65 | err = single_open(file, show, net); | ||
| 66 | if (err < 0) | ||
| 67 | goto err_open; | ||
| 68 | |||
| 69 | return 0; | ||
| 70 | |||
| 71 | err_open: | ||
| 72 | put_net(net); | ||
| 73 | err_net: | ||
| 74 | return err; | ||
| 75 | } | ||
| 76 | EXPORT_SYMBOL_GPL(single_open_net); | ||
| 77 | |||
| 54 | int seq_release_net(struct inode *ino, struct file *f) | 78 | int seq_release_net(struct inode *ino, struct file *f) |
| 55 | { | 79 | { |
| 56 | struct seq_file *seq; | 80 | struct seq_file *seq; |
| @@ -63,6 +87,14 @@ int seq_release_net(struct inode *ino, struct file *f) | |||
| 63 | } | 87 | } |
| 64 | EXPORT_SYMBOL_GPL(seq_release_net); | 88 | EXPORT_SYMBOL_GPL(seq_release_net); |
| 65 | 89 | ||
| 90 | int single_release_net(struct inode *ino, struct file *f) | ||
| 91 | { | ||
| 92 | struct seq_file *seq = f->private_data; | ||
| 93 | put_net(seq->private); | ||
| 94 | return single_release(ino, f); | ||
| 95 | } | ||
| 96 | EXPORT_SYMBOL_GPL(single_release_net); | ||
| 97 | |||
| 66 | static struct net *get_proc_task_net(struct inode *dir) | 98 | static struct net *get_proc_task_net(struct inode *dir) |
| 67 | { | 99 | { |
| 68 | struct task_struct *task; | 100 | struct task_struct *task; |
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c index 21f490f5d65c..d153946d6d15 100644 --- a/fs/proc/proc_tty.c +++ b/fs/proc/proc_tty.c | |||
| @@ -136,54 +136,6 @@ static const struct file_operations proc_tty_drivers_operations = { | |||
| 136 | .release = seq_release, | 136 | .release = seq_release, |
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| 139 | static void * tty_ldiscs_seq_start(struct seq_file *m, loff_t *pos) | ||
| 140 | { | ||
| 141 | return (*pos < NR_LDISCS) ? pos : NULL; | ||
| 142 | } | ||
| 143 | |||
| 144 | static void * tty_ldiscs_seq_next(struct seq_file *m, void *v, loff_t *pos) | ||
| 145 | { | ||
| 146 | (*pos)++; | ||
| 147 | return (*pos < NR_LDISCS) ? pos : NULL; | ||
| 148 | } | ||
| 149 | |||
| 150 | static void tty_ldiscs_seq_stop(struct seq_file *m, void *v) | ||
| 151 | { | ||
| 152 | } | ||
| 153 | |||
| 154 | static int tty_ldiscs_seq_show(struct seq_file *m, void *v) | ||
| 155 | { | ||
| 156 | int i = *(loff_t *)v; | ||
| 157 | struct tty_ldisc *ld; | ||
| 158 | |||
| 159 | ld = tty_ldisc_get(i); | ||
| 160 | if (ld == NULL) | ||
| 161 | return 0; | ||
| 162 | seq_printf(m, "%-10s %2d\n", ld->name ? ld->name : "???", i); | ||
| 163 | tty_ldisc_put(i); | ||
| 164 | return 0; | ||
| 165 | } | ||
| 166 | |||
| 167 | static const struct seq_operations tty_ldiscs_seq_ops = { | ||
| 168 | .start = tty_ldiscs_seq_start, | ||
| 169 | .next = tty_ldiscs_seq_next, | ||
| 170 | .stop = tty_ldiscs_seq_stop, | ||
| 171 | .show = tty_ldiscs_seq_show, | ||
| 172 | }; | ||
| 173 | |||
| 174 | static int proc_tty_ldiscs_open(struct inode *inode, struct file *file) | ||
| 175 | { | ||
| 176 | return seq_open(file, &tty_ldiscs_seq_ops); | ||
| 177 | } | ||
| 178 | |||
| 179 | static const struct file_operations tty_ldiscs_proc_fops = { | ||
| 180 | .owner = THIS_MODULE, | ||
| 181 | .open = proc_tty_ldiscs_open, | ||
| 182 | .read = seq_read, | ||
| 183 | .llseek = seq_lseek, | ||
| 184 | .release = seq_release, | ||
| 185 | }; | ||
| 186 | |||
| 187 | /* | 139 | /* |
| 188 | * This function is called by tty_register_driver() to handle | 140 | * This function is called by tty_register_driver() to handle |
| 189 | * registering the driver's /proc handler into /proc/tty/driver/<foo> | 141 | * registering the driver's /proc handler into /proc/tty/driver/<foo> |
