Skip to content

Commit 2781b86

Browse files
hverkuilgregkh
authored andcommitted
media: cec: forgot to cancel delayed work
commit 490d84f 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: 7ec2b3b ("cec: add new tx/rx status bits to detect aborts/timeouts") Signed-off-by: Hans Verkuil <[email protected]> Cc: <[email protected]> # for v4.18 and up Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b68d405 commit 2781b86

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/media/cec/cec-adap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,8 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
831831
*/
832832
mutex_unlock(&adap->lock);
833833
wait_for_completion_killable(&data->c);
834+
if (!data->completed)
835+
cancel_delayed_work_sync(&data->work);
834836
mutex_lock(&adap->lock);
835837

836838
/* Cancel the transmit if it was interrupted */

0 commit comments

Comments
 (0)