aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/futex.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 07ba87de9658..ca05fe6a70b2 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -786,23 +786,17 @@ static int futex_fd(unsigned long uaddr, int signal)
786 filp->f_mapping = filp->f_dentry->d_inode->i_mapping; 786 filp->f_mapping = filp->f_dentry->d_inode->i_mapping;
787 787
788 if (signal) { 788 if (signal) {
789 int err;
790 err = f_setown(filp, current->pid, 1); 789 err = f_setown(filp, current->pid, 1);
791 if (err < 0) { 790 if (err < 0) {
792 put_unused_fd(ret); 791 goto error;
793 put_filp(filp);
794 ret = err;
795 goto out;
796 } 792 }
797 filp->f_owner.signum = signal; 793 filp->f_owner.signum = signal;
798 } 794 }
799 795
800 q = kmalloc(sizeof(*q), GFP_KERNEL); 796 q = kmalloc(sizeof(*q), GFP_KERNEL);
801 if (!q) { 797 if (!q) {
802 put_unused_fd(ret); 798 err = -ENOMEM;
803 put_filp(filp); 799 goto error;
804 ret = -ENOMEM;
805 goto out;
806 } 800 }
807 801
808 down_read(&current->mm->mmap_sem); 802 down_read(&current->mm->mmap_sem);
@@ -810,10 +804,8 @@ static int futex_fd(unsigned long uaddr, int signal)
810 804
811 if (unlikely(err != 0)) { 805 if (unlikely(err != 0)) {
812 up_read(&current->mm->mmap_sem); 806 up_read(&current->mm->mmap_sem);
813 put_unused_fd(ret);
814 put_filp(filp);
815 kfree(q); 807 kfree(q);
816 return err; 808 goto error;
817 } 809 }
818 810
819 /* 811 /*
@@ -829,6 +821,11 @@ static int futex_fd(unsigned long uaddr, int signal)
829 fd_install(ret, filp); 821 fd_install(ret, filp);
830out: 822out:
831 return ret; 823 return ret;
824error:
825 put_unused_fd(ret);
826 put_filp(filp);
827 ret = err;
828 goto out;
832} 829}
833 830
834long do_futex(unsigned long uaddr, int op, int val, unsigned long timeout, 831long do_futex(unsigned long uaddr, int op, int val, unsigned long timeout,