diff options
author | Patrick Caulfield <pcaulfie@redhat.com> | 2006-11-02 09:41:23 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-11-06 09:01:07 -0500 |
commit | ba542e3b92f9ea7c482ae56b68b9122eebc53a39 (patch) | |
tree | 22ab000c6d5aca9d0c34ef68b8901048628672ed /fs/dlm | |
parent | 26d83dedf61d26d85f10bc34b92f4de7660fd746 (diff) |
[DLM] Fix kref_put oops
This patch fixes the recounting on the lockspace kobject. Previously the lockspace was freed while userspace could have had a
reference to one of its sysfs files, causing an oops in kref_put.
Now the lockspace kfree is moved into the kobject release() function
Signed-Off-By: Patrick Caulfield <pcaulfie@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/lockspace.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 109333c8ecb9..499ee1156365 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -143,6 +143,12 @@ static ssize_t dlm_attr_store(struct kobject *kobj, struct attribute *attr, | |||
143 | return a->store ? a->store(ls, buf, len) : len; | 143 | return a->store ? a->store(ls, buf, len) : len; |
144 | } | 144 | } |
145 | 145 | ||
146 | static void lockspace_kobj_release(struct kobject *k) | ||
147 | { | ||
148 | struct dlm_ls *ls = container_of(k, struct dlm_ls, ls_kobj); | ||
149 | kfree(ls); | ||
150 | } | ||
151 | |||
146 | static struct sysfs_ops dlm_attr_ops = { | 152 | static struct sysfs_ops dlm_attr_ops = { |
147 | .show = dlm_attr_show, | 153 | .show = dlm_attr_show, |
148 | .store = dlm_attr_store, | 154 | .store = dlm_attr_store, |
@@ -151,6 +157,7 @@ static struct sysfs_ops dlm_attr_ops = { | |||
151 | static struct kobj_type dlm_ktype = { | 157 | static struct kobj_type dlm_ktype = { |
152 | .default_attrs = dlm_attrs, | 158 | .default_attrs = dlm_attrs, |
153 | .sysfs_ops = &dlm_attr_ops, | 159 | .sysfs_ops = &dlm_attr_ops, |
160 | .release = lockspace_kobj_release, | ||
154 | }; | 161 | }; |
155 | 162 | ||
156 | static struct kset dlm_kset = { | 163 | static struct kset dlm_kset = { |
@@ -678,7 +685,7 @@ static int release_lockspace(struct dlm_ls *ls, int force) | |||
678 | dlm_clear_members_gone(ls); | 685 | dlm_clear_members_gone(ls); |
679 | kfree(ls->ls_node_array); | 686 | kfree(ls->ls_node_array); |
680 | kobject_unregister(&ls->ls_kobj); | 687 | kobject_unregister(&ls->ls_kobj); |
681 | kfree(ls); | 688 | /* The ls structure will be freed when the kobject is done with */ |
682 | 689 | ||
683 | mutex_lock(&ls_lock); | 690 | mutex_lock(&ls_lock); |
684 | ls_count--; | 691 | ls_count--; |