Commit bba1f675 authored by Al Viro's avatar Al Viro

lirc: rc_dev_get_from_fd(): fix file leak

missing fdput() on a failure exit

Fixes: 6a9d5524 "media: rc: bpf attach/detach requires write permission" # v6.9
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent b4cf5fc0
......@@ -828,8 +828,10 @@ struct rc_dev *rc_dev_get_from_fd(int fd, bool write)
return ERR_PTR(-EINVAL);
}
if (write && !(f.file->f_mode & FMODE_WRITE))
if (write && !(f.file->f_mode & FMODE_WRITE)) {
fdput(f);
return ERR_PTR(-EPERM);
}
fh = f.file->private_data;
dev = fh->rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment