diff options
| author | Hans Verkuil <hans.verkuil@cisco.com> | 2016-11-04 07:52:11 -0200 |
|---|---|---|
| committer | Ray Zhang <rayz@codeaurora.org> | 2017-05-25 11:22:15 +0800 |
| commit | 5b959979fb411ed37b4bd2d968c7e7ba4f557d72 (patch) | |
| tree | 27f33e9811fad1748f6f5c0337fa563d131527c3 | |
| parent | 97645478141478b2b80554df9566d92947b0a141 (diff) | |
[media] cec: sanitize msg.flags
The CEC_MSG_FL_REPLY_TO_FOLLOWERS message flag only makes sense for transmitted
messages where you want to wait for the reply.
Clear the flag in all other cases.
Change-Id: Icb52984770fe442416a8e46dff717b0849a7bdb4
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Git-commit: 7ae2a888eedd5a6b03849614eddd55f31793eeae
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Signed-off-by: Ray Zhang <rayz@codeaurora.org>
| -rw-r--r-- | drivers/media/cec/cec-adap.c | 4 | ||||
| -rw-r--r-- | drivers/media/cec/cec-api.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c index 054cd06e2247..bcd19d41c166 100644 --- a/drivers/media/cec/cec-adap.c +++ b/drivers/media/cec/cec-adap.c @@ -595,6 +595,10 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, /* Make sure the timeout isn't 0. */ msg->timeout = 1000; } + if (msg->timeout) + msg->flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS; + else + msg->flags = 0; /* Sanity checks */ if (msg->len == 0 || msg->len > CEC_MAX_MSG_SIZE) { diff --git a/drivers/media/cec/cec-api.c b/drivers/media/cec/cec-api.c index d4bc4ee2c6e5..597fbb62d829 100644 --- a/drivers/media/cec/cec-api.c +++ b/drivers/media/cec/cec-api.c @@ -197,7 +197,6 @@ static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh, (msg.len == 1 || msg.msg[1] != CEC_MSG_CDC_MESSAGE)) return -EINVAL; - msg.flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS; mutex_lock(&adap->lock); if (!adap->is_configured) err = -ENONET; @@ -282,6 +281,7 @@ static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh, err = cec_receive_msg(fh, &msg, block); if (err) return err; + msg.flags = 0; if (copy_to_user(parg, &msg, sizeof(msg))) return -EFAULT; return 0; |
