提交 2781b86d 编写于 作者: H Hans Verkuil 提交者: Greg Kroah-Hartman

media: cec: forgot to cancel delayed work

commit 490d84f6d73c12f4204241cff8651eed60aae914 upstream.

If the wait for completion was interrupted, then make sure to cancel
any delayed work.

This can only happen if a transmit is waiting for a reply, and you press
Ctrl-C or reboot/poweroff or something like that which interrupts the
thread waiting for the reply and then proceeds to delete the CEC message.

Since the delayed work wasn't canceled, once it would trigger it referred
to stale data and resulted in a kernel oops.

Fixes: 7ec2b3b941a6 ("cec: add new tx/rx status bits to detect aborts/timeouts")
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org>      # for v4.18 and up
Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 b68d405a
...@@ -831,6 +831,8 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, ...@@ -831,6 +831,8 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
*/ */
mutex_unlock(&adap->lock); mutex_unlock(&adap->lock);
wait_for_completion_killable(&data->c); wait_for_completion_killable(&data->c);
if (!data->completed)
cancel_delayed_work_sync(&data->work);
mutex_lock(&adap->lock); mutex_lock(&adap->lock);
/* Cancel the transmit if it was interrupted */ /* Cancel the transmit if it was interrupted */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册