[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200605162518.28099-15-florian.fainelli@broadcom.com>
Date: Fri, 5 Jun 2020 09:25:11 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: linux-kernel@...r.kernel.org
Cc: stable@...r.kernel.org,
Mauro Carvalho Chehab <mchehab@...pensource.com>,
Florian Fainelli <f.fainelli@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Michael Krufky <mkrufky@...uxtv.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Shuah Khan <shuah@...nel.org>,
Jaedon Shin <jaedon.shin@...il.com>,
Colin Ian King <colin.king@...onical.com>,
Katsuhiro Suzuki <suzuki.katsuhiro@...ionext.com>,
Satendra Singh Thakur <satendra.t@...sung.com>,
linux-media@...r.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE
(V4L/DVB)),
linux-fsdevel@...r.kernel.org (open list:FILESYSTEMS (VFS and
infrastructure))
Subject: [PATCH stable 4.9 14/21] media: dvb_frontend: fix return values for FE_SET_PROPERTY
From: Mauro Carvalho Chehab <mchehab@...pensource.com>
commit 259a41d9ae8f3689742267f340ad2b159d00b302 upstream
There are several problems with regards to the return of
FE_SET_PROPERTY. The original idea were to return per-property
return codes via tvp->result field, and to return an updated
set of values.
However, that never worked. What's actually implemented is:
- the FE_SET_PROPERTY implementation doesn't call .get_frontend
callback in order to get the actual parameters after return;
- the tvp->result field is only filled if there's no error.
So, it is always filled with zero;
- FE_SET_PROPERTY doesn't call memdup_user() nor any other
copy_to_user() function. So, any changes to the properties
will be lost;
- FE_SET_PROPERTY is declared as a write-only ioctl (IOW).
While we could fix the above, it could cause regressions.
So, let's just assume what the code really does, updating
the documentation accordingly and removing the logic that
would update the discarded tvp->result.
Reviewed-by: Shuah Khan <shuahkh@....samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@...pensource.com>
Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
---
Documentation/media/uapi/dvb/fe-get-property.rst | 7 +++++--
drivers/media/dvb-core/dvb_frontend.c | 2 --
include/uapi/linux/dvb/frontend.h | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/Documentation/media/uapi/dvb/fe-get-property.rst b/Documentation/media/uapi/dvb/fe-get-property.rst
index 015d4db597b5..c80c5fc6e916 100644
--- a/Documentation/media/uapi/dvb/fe-get-property.rst
+++ b/Documentation/media/uapi/dvb/fe-get-property.rst
@@ -48,8 +48,11 @@ depends on the delivery system and on the device:
- This call requires read/write access to the device.
- - At return, the values are updated to reflect the actual parameters
- used.
+.. note::
+
+ At return, the values aren't updated to reflect the actual
+ parameters used. If the actual parameters are needed, an explicit
+ call to ``FE_GET_PROPERTY`` is needed.
- ``FE_GET_PROPERTY:``
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index 673cefb7230c..ca4959bbb6c2 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -2127,7 +2127,6 @@ static int dvb_frontend_handle_ioctl(struct file *file,
kfree(tvp);
return err;
}
- (tvp + i)->result = err;
}
kfree(tvp);
break;
@@ -2172,7 +2171,6 @@ static int dvb_frontend_handle_ioctl(struct file *file,
kfree(tvp);
return err;
}
- (tvp + i)->result = err;
}
if (copy_to_user((void __user *)tvps->props, tvp,
diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h
index 16a318fc469a..b653754ee9cf 100644
--- a/include/uapi/linux/dvb/frontend.h
+++ b/include/uapi/linux/dvb/frontend.h
@@ -830,7 +830,7 @@ struct dtv_fe_stats {
* @cmd: Digital TV command.
* @reserved: Not used.
* @u: Union with the values for the command.
- * @result: Result of the command set (currently unused).
+ * @result: Unused
*
* The @u union may have either one of the values below:
*
--
2.17.1
Powered by blists - more mailing lists