Commit 005fbcd0 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'driver-core-3.15-rc3' of...

Merge tag 'driver-core-3.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
 "Here are some kernfs fixes for 3.15-rc3 that resolve some reported
  problems.  Nothing huge, but all needed"

* tag 'driver-core-3.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  s390/ccwgroup: Fix memory corruption
  kernfs: add back missing error check in kernfs_fop_mmap()
  kernfs: fix a subdir count leak
parents fefb8275 0c8c77d3
...@@ -22,8 +22,8 @@ struct ccwgroup_device { ...@@ -22,8 +22,8 @@ struct ccwgroup_device {
/* public: */ /* public: */
unsigned int count; unsigned int count;
struct device dev; struct device dev;
struct ccw_device *cdev[0];
struct work_struct ungroup_work; struct work_struct ungroup_work;
struct ccw_device *cdev[0];
}; };
/** /**
......
...@@ -232,9 +232,6 @@ static int kernfs_link_sibling(struct kernfs_node *kn) ...@@ -232,9 +232,6 @@ static int kernfs_link_sibling(struct kernfs_node *kn)
struct rb_node **node = &kn->parent->dir.children.rb_node; struct rb_node **node = &kn->parent->dir.children.rb_node;
struct rb_node *parent = NULL; struct rb_node *parent = NULL;
if (kernfs_type(kn) == KERNFS_DIR)
kn->parent->dir.subdirs++;
while (*node) { while (*node) {
struct kernfs_node *pos; struct kernfs_node *pos;
int result; int result;
...@@ -249,9 +246,15 @@ static int kernfs_link_sibling(struct kernfs_node *kn) ...@@ -249,9 +246,15 @@ static int kernfs_link_sibling(struct kernfs_node *kn)
else else
return -EEXIST; return -EEXIST;
} }
/* add new node and rebalance the tree */ /* add new node and rebalance the tree */
rb_link_node(&kn->rb, parent, node); rb_link_node(&kn->rb, parent, node);
rb_insert_color(&kn->rb, &kn->parent->dir.children); rb_insert_color(&kn->rb, &kn->parent->dir.children);
/* successfully added, account subdir number */
if (kernfs_type(kn) == KERNFS_DIR)
kn->parent->dir.subdirs++;
return 0; return 0;
} }
......
...@@ -484,6 +484,8 @@ static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -484,6 +484,8 @@ static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma)
ops = kernfs_ops(of->kn); ops = kernfs_ops(of->kn);
rc = ops->mmap(of, vma); rc = ops->mmap(of, vma);
if (rc)
goto out_put;
/* /*
* PowerPC's pci_mmap of legacy_mem uses shmem_zero_setup() * PowerPC's pci_mmap of legacy_mem uses shmem_zero_setup()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment