From cedbf472cf302d809a7c16a37765b7c77633fa9c Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Mon, 20 Sep 2010 00:56:27 -0700 Subject: [PATCH] --- yaml --- r: 213466 b: refs/heads/master c: a6849fa1f7d7d7adbeb6a696beeabfa078acf173 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/sysfs/bin.c | 26 ++++++++------------------ 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/[refs] b/[refs] index 8a8e9ddefd1a..221428d30ea0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5fc6e9cbce3342379719fc0f8294c45bb888f5cc +refs/heads/master: a6849fa1f7d7d7adbeb6a696beeabfa078acf173 diff --git a/trunk/fs/sysfs/bin.c b/trunk/fs/sysfs/bin.c index 4e321f7353fa..d31d7b7d5426 100644 --- a/trunk/fs/sysfs/bin.c +++ b/trunk/fs/sysfs/bin.c @@ -190,23 +190,6 @@ static void bin_vma_open(struct vm_area_struct *vma) sysfs_put_active(attr_sd); } -static void bin_vma_close(struct vm_area_struct *vma) -{ - struct file *file = vma->vm_file; - struct bin_buffer *bb = file->private_data; - struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; - - if (!bb->vm_ops || !bb->vm_ops->close) - return; - - if (!sysfs_get_active(attr_sd)) - return; - - bb->vm_ops->close(vma); - - sysfs_put_active(attr_sd); -} - static int bin_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct file *file = vma->vm_file; @@ -331,7 +314,6 @@ static int bin_migrate(struct vm_area_struct *vma, const nodemask_t *from, static const struct vm_operations_struct bin_vm_ops = { .open = bin_vma_open, - .close = bin_vma_close, .fault = bin_fault, .page_mkwrite = bin_page_mkwrite, .access = bin_access, @@ -377,6 +359,14 @@ static int mmap(struct file *file, struct vm_area_struct *vma) if (bb->mmapped && bb->vm_ops != vma->vm_ops) goto out_put; + /* + * It is not possible to successfully wrap close. + * So error if someone is trying to use close. + */ + rc = -EINVAL; + if (vma->vm_ops && vma->vm_ops->close) + goto out_put; + rc = 0; bb->mmapped = 1; bb->vm_ops = vma->vm_ops;