linux_dsm_epyc7002/drivers/media/cec
Hans Verkuil f60f35609f [media] cec: fix race between configuring and unconfiguring
This race was discovered by running cec-compliance -A with the cec module debug
parameter set to 2: suddenly the test would fail.

It turns out that this happens when the test configures the adapter in
non-blocking mode, then it waits for the CEC_EVENT_STATE_CHANGE event and once
the event is received it unconfigures the adapter.

What happened was that the unconfigure was executed while the configure was
still transmitting the Report Features and Report Physical Address messages.
This messed up the internal state of the cec_adapter.

The fix is to transmit those messages with the adap->lock mutex held (this will
just queue them up in the internal transmit queue, and not actually transmit
anything yet). Only unlock the mutex once everything is done. The main thread
will dequeue the messages from the internal transmit queue and transmit them
one by one, unless an unconfigure was done, and in that case any messages are
just dropped.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-12-21 07:03:27 -02:00
..
cec-adap.c [media] cec: fix race between configuring and unconfiguring 2016-12-21 07:03:27 -02:00
cec-api.c [media] cec: pass parent device in register(), not allocate() 2016-11-29 12:07:17 -02:00
cec-core.c [media] cec: pass parent device in register(), not allocate() 2016-11-29 12:07:17 -02:00
cec-priv.h [media] cec: move the CEC framework out of staging and to media 2016-11-16 15:40:20 -02:00
Makefile [media] cec: move the CEC framework out of staging and to media 2016-11-16 15:40:20 -02:00