.llseek = noop_llseek,
};
-static struct file *timerfd_fget(int fd)
+static struct file *timerfd_fget(int fd, int *fput_needed)
{
struct file *file;
- file = fget(fd);
+ file = fget_light(fd, fput_needed);
if (!file)
return ERR_PTR(-EBADF);
if (file->f_op != &timerfd_fops) {
- fput(file);
+ fput_light(file, *fput_needed);
return ERR_PTR(-EINVAL);
}
struct file *file;
struct timerfd_ctx *ctx;
struct itimerspec ktmr, kotmr;
- int ret;
+ int ret, fput_needed;
if (copy_from_user(&ktmr, utmr, sizeof(ktmr)))
return -EFAULT;
!timespec_valid(&ktmr.it_interval))
return -EINVAL;
- file = timerfd_fget(ufd);
+ file = timerfd_fget(ufd, &fput_needed);
if (IS_ERR(file))
return PTR_ERR(file);
ctx = file->private_data;
ret = timerfd_setup(ctx, flags, &ktmr);
spin_unlock_irq(&ctx->wqh.lock);
- fput(file);
+ fput_light(file, fput_needed);
if (otmr && copy_to_user(otmr, &kotmr, sizeof(kotmr)))
return -EFAULT;
struct file *file;
struct timerfd_ctx *ctx;
struct itimerspec kotmr;
+ int fput_needed;
- file = timerfd_fget(ufd);
+ file = timerfd_fget(ufd, &fput_needed);
if (IS_ERR(file))
return PTR_ERR(file);
ctx = file->private_data;
kotmr.it_value = ktime_to_timespec(timerfd_get_remaining(ctx));
kotmr.it_interval = ktime_to_timespec(ctx->tintv);
spin_unlock_irq(&ctx->wqh.lock);
- fput(file);
+ fput_light(file, fput_needed);
return copy_to_user(otmr, &kotmr, sizeof(kotmr)) ? -EFAULT: 0;
}