Skip to contentSkip to conversation

FAILED: patch "[PATCH] media: cec: forgot to cancel delayed work" failed to apply to 4.18-stable tree

PATCH [email protected] 1 participant 1 message Nov 11, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 490d84f6d73c12f4204241cff8651eed60aae914 Mon Sep 17 00:00:00 2001

From: Hans Verkuil <[email protected]>
Date: Mon, 15 Oct 2018 06:14:22 -0400
Subject: [PATCH] media: cec: forgot to cancel delayed work

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")
drivers/media/cec/cec-adap.c +2 -0
index 0c0d9107383e..31d1f4ab915e 100644
@@ -844,6 +844,8 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
 	 */
 	mutex_unlock(&adap->lock);
 	wait_for_completion_killable(&data->c);
+	if (!data->completed)
+		cancel_delayed_work_sync(&data->work);
 	mutex_lock(&adap->lock);
 
 	/* Cancel the transmit if it was interrupted */