Message ID | a4a1c1dd-56ae-e949-2504-e8c2e2829a05@xs4all.nl (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vivid: ignore failed messages in vivid_received() | expand |
On 27/04/2023 22:49, Hans Verkuil wrote: > If a non-blocking transmit failed (either the transmit itself failed, > or the reply (if requested) never arrived, then the received callback > is still called since in some cases a driver might need to know about > that. > > The vivid_received function didn't check this and instead could try to > transmit a reply, which can lead to a deadlock. > > Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > --- > diff --git a/drivers/media/test-drivers/vivid/vivid-cec.c b/drivers/media/test-drivers/vivid/vivid-cec.c > index 1f7469ff04d5..8399298d54ad 100644 > --- a/drivers/media/test-drivers/vivid/vivid-cec.c > +++ b/drivers/media/test-drivers/vivid/vivid-cec.c > @@ -269,6 +269,9 @@ static int vivid_received(struct cec_adapter *adap, struct cec_msg *msg) > u8 disp_ctl; > char osd[14]; > > + if (!cec_msg_status_is_ok(msg)) > + return 0; > + > if (cec_msg_is_broadcast(msg)) > dest = adap->log_addrs.log_addr[0]; > cec_msg_init(&reply, dest, cec_msg_initiator(msg)); Disregard this, this is not the right approach. Regards, Hans
diff --git a/drivers/media/test-drivers/vivid/vivid-cec.c b/drivers/media/test-drivers/vivid/vivid-cec.c index 1f7469ff04d5..8399298d54ad 100644 --- a/drivers/media/test-drivers/vivid/vivid-cec.c +++ b/drivers/media/test-drivers/vivid/vivid-cec.c @@ -269,6 +269,9 @@ static int vivid_received(struct cec_adapter *adap, struct cec_msg *msg) u8 disp_ctl; char osd[14]; + if (!cec_msg_status_is_ok(msg)) + return 0; + if (cec_msg_is_broadcast(msg)) dest = adap->log_addrs.log_addr[0]; cec_msg_init(&reply, dest, cec_msg_initiator(msg));
If a non-blocking transmit failed (either the transmit itself failed, or the reply (if requested) never arrived, then the received callback is still called since in some cases a driver might need to know about that. The vivid_received function didn't check this and instead could try to transmit a reply, which can lead to a deadlock. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> ---