diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-09-18 08:05:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-10-11 12:57:47 -0400 |
commit | da5516b5e81d45a96291823620f6c820178dc055 (patch) | |
tree | 44972ef069f759be8580d9aac09184da60e4c55e /drivers/media/dvb-core | |
parent | ceb22c8eeecaf51f88a49202d00ea599b9e15477 (diff) | |
download | linux-da5516b5e81d45a96291823620f6c820178dc055.tar.bz2 |
media: dvb_frontend: better document the -EPERM condition
Two readonly ioctls can't be allowed if the frontend device
is opened in read only mode. Explain why.
Reviewed by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-core')
-rw-r--r-- | drivers/media/dvb-core/dvb_frontend.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 45d0d488dfcb..b19f40be0ab2 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1923,9 +1923,23 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) return -ENODEV; } - if ((file->f_flags & O_ACCMODE) == O_RDONLY && - (_IOC_DIR(cmd) != _IOC_READ || cmd == FE_GET_EVENT || - cmd == FE_DISEQC_RECV_SLAVE_REPLY)) { + /* + * If the frontend is opened in read-only mode, only the ioctls + * that don't interfere with the tune logic should be accepted. + * That allows an external application to monitor the DVB QoS and + * statistics parameters. + * + * That matches all _IOR() ioctls, except for two special cases: + * - FE_GET_EVENT is part of the tuning logic on a DVB application; + * - FE_DISEQC_RECV_SLAVE_REPLY is part of DiSEqC 2.0 + * setup + * So, those two ioctls should also return -EPERM, as otherwise + * reading from them would interfere with a DVB tune application + */ + if ((file->f_flags & O_ACCMODE) == O_RDONLY + && (_IOC_DIR(cmd) != _IOC_READ + || cmd == FE_GET_EVENT + || cmd == FE_DISEQC_RECV_SLAVE_REPLY)) { up(&fepriv->sem); return -EPERM; } |