]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blobdiff - fs/signalfd.c
NFSv4: Handle case where the lookup of a directory fails
[mirror_ubuntu-focal-kernel.git] / fs / signalfd.c
index 44b6845b071c3321872cfce6d1cf3c672077480f..3e94d181930fdd0042aa2069230d20ddb31d5698 100644 (file)
 
 void signalfd_cleanup(struct sighand_struct *sighand)
 {
-       wait_queue_head_t *wqh = &sighand->signalfd_wqh;
-       /*
-        * The lockless check can race with remove_wait_queue() in progress,
-        * but in this case its caller should run under rcu_read_lock() and
-        * sighand_cachep is SLAB_TYPESAFE_BY_RCU, we can safely return.
-        */
-       if (likely(!waitqueue_active(wqh)))
-               return;
-
-       /* wait_queue_entry_t->func(POLLFREE) should do remove_wait_queue() */
-       wake_up_poll(wqh, EPOLLHUP | POLLFREE);
+       wake_up_pollfree(&sighand->signalfd_wqh);
 }
 
 struct signalfd_ctx {
@@ -314,9 +304,10 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
 {
        sigset_t mask;
 
-       if (sizemask != sizeof(sigset_t) ||
-           copy_from_user(&mask, user_mask, sizeof(mask)))
+       if (sizemask != sizeof(sigset_t))
                return -EINVAL;
+       if (copy_from_user(&mask, user_mask, sizeof(mask)))
+               return -EFAULT;
        return do_signalfd4(ufd, &mask, flags);
 }
 
@@ -325,9 +316,10 @@ SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
 {
        sigset_t mask;
 
-       if (sizemask != sizeof(sigset_t) ||
-           copy_from_user(&mask, user_mask, sizeof(mask)))
+       if (sizemask != sizeof(sigset_t))
                return -EINVAL;
+       if (copy_from_user(&mask, user_mask, sizeof(mask)))
+               return -EFAULT;
        return do_signalfd4(ufd, &mask, 0);
 }