diff options
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/mqueue.c | 25 | ||||
-rw-r--r-- | ipc/shm.c | 6 |
2 files changed, 22 insertions, 9 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 60f7a27f7a9e..94fd3b08fb77 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -598,6 +598,7 @@ static struct file *do_create(struct dentry *dir, struct dentry *dentry, | |||
598 | int oflag, mode_t mode, struct mq_attr __user *u_attr) | 598 | int oflag, mode_t mode, struct mq_attr __user *u_attr) |
599 | { | 599 | { |
600 | struct mq_attr attr; | 600 | struct mq_attr attr; |
601 | struct file *result; | ||
601 | int ret; | 602 | int ret; |
602 | 603 | ||
603 | if (u_attr) { | 604 | if (u_attr) { |
@@ -612,13 +613,24 @@ static struct file *do_create(struct dentry *dir, struct dentry *dentry, | |||
612 | } | 613 | } |
613 | 614 | ||
614 | mode &= ~current->fs->umask; | 615 | mode &= ~current->fs->umask; |
616 | ret = mnt_want_write(mqueue_mnt); | ||
617 | if (ret) | ||
618 | goto out; | ||
615 | ret = vfs_create(dir->d_inode, dentry, mode, NULL); | 619 | ret = vfs_create(dir->d_inode, dentry, mode, NULL); |
616 | dentry->d_fsdata = NULL; | 620 | dentry->d_fsdata = NULL; |
617 | if (ret) | 621 | if (ret) |
618 | goto out; | 622 | goto out_drop_write; |
619 | 623 | ||
620 | return dentry_open(dentry, mqueue_mnt, oflag); | 624 | result = dentry_open(dentry, mqueue_mnt, oflag); |
621 | 625 | /* | |
626 | * dentry_open() took a persistent mnt_want_write(), | ||
627 | * so we can now drop this one. | ||
628 | */ | ||
629 | mnt_drop_write(mqueue_mnt); | ||
630 | return result; | ||
631 | |||
632 | out_drop_write: | ||
633 | mnt_drop_write(mqueue_mnt); | ||
622 | out: | 634 | out: |
623 | dput(dentry); | 635 | dput(dentry); |
624 | mntput(mqueue_mnt); | 636 | mntput(mqueue_mnt); |
@@ -742,8 +754,11 @@ asmlinkage long sys_mq_unlink(const char __user *u_name) | |||
742 | inode = dentry->d_inode; | 754 | inode = dentry->d_inode; |
743 | if (inode) | 755 | if (inode) |
744 | atomic_inc(&inode->i_count); | 756 | atomic_inc(&inode->i_count); |
745 | 757 | err = mnt_want_write(mqueue_mnt); | |
758 | if (err) | ||
759 | goto out_err; | ||
746 | err = vfs_unlink(dentry->d_parent->d_inode, dentry); | 760 | err = vfs_unlink(dentry->d_parent->d_inode, dentry); |
761 | mnt_drop_write(mqueue_mnt); | ||
747 | out_err: | 762 | out_err: |
748 | dput(dentry); | 763 | dput(dentry); |
749 | 764 | ||
@@ -271,11 +271,9 @@ static struct mempolicy *shm_get_policy(struct vm_area_struct *vma, | |||
271 | 271 | ||
272 | if (sfd->vm_ops->get_policy) | 272 | if (sfd->vm_ops->get_policy) |
273 | pol = sfd->vm_ops->get_policy(vma, addr); | 273 | pol = sfd->vm_ops->get_policy(vma, addr); |
274 | else if (vma->vm_policy) { | 274 | else if (vma->vm_policy) |
275 | pol = vma->vm_policy; | 275 | pol = vma->vm_policy; |
276 | mpol_get(pol); /* get_vma_policy() expects this */ | 276 | |
277 | } else | ||
278 | pol = current->mempolicy; | ||
279 | return pol; | 277 | return pol; |
280 | } | 278 | } |
281 | #endif | 279 | #endif |