mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-22 20:30:58 +02:00
media: rc: bpf attach/detach requires write permission
Note that bpf attach/detach also requires CAP_NET_ADMIN. Cc: stable@vger.kernel.org Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
@@ -813,7 +813,7 @@ void __exit lirc_dev_exit(void)
|
||||
unregister_chrdev_region(lirc_base_dev, RC_DEV_MAX);
|
||||
}
|
||||
|
||||
struct rc_dev *rc_dev_get_from_fd(int fd)
|
||||
struct rc_dev *rc_dev_get_from_fd(int fd, bool write)
|
||||
{
|
||||
struct fd f = fdget(fd);
|
||||
struct lirc_fh *fh;
|
||||
@@ -827,6 +827,9 @@ struct rc_dev *rc_dev_get_from_fd(int fd)
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
if (write && !(f.file->f_mode & FMODE_WRITE))
|
||||
return ERR_PTR(-EPERM);
|
||||
|
||||
fh = f.file->private_data;
|
||||
dev = fh->rc;
|
||||
|
||||
|
Reference in New Issue
Block a user