Skip to contentSkip to conversation

vivid: ignore failed messages in vivid_received()

PATCH In review Hans Verkuil 1 participant 2 messages Apr 27, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vivid: ignore failed messages in vivid_received()

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.

---

drivers/media/test-drivers/vivid/vivid-cec.c +3 -0
index 1f7469ff04d5..8399298d54ad 100644
@@ -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));
#1 lore raw
Quoted 15 lines · Hans Verkuil

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.

---

drivers/media/test-drivers/vivid/vivid-cec.c +0 -0
index 1f7469ff04d5..8399298d54ad 100644

drivers/media/test-drivers/vivid/vivid-cec.c static int vivid_received(struct cec_adapter *adap, struct cec_msg *msg) · line 277

Quoted 9 lines
drivers/media/test-drivers/vivid/vivid-cec.c +3 -0
@@ -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