Skip to contentSkip to conversation

rpmsg: glink: use only lower 16-bits of param2 for CMD_OPEN name length

PATCH In review Jonathan Marek 2 participants 2 messages Oct 8, 2024

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

PATCH v2 1/1 rpmsg: glink: use only lower 16-bits of param2 for CMD_OPEN name length

The name len field of the CMD_OPEN packet is only 16-bits and the upper 16-bits of "param2" are a different "prio" field, which can be nonzero in certain situations, and CMD_OPEN packets can be unexpectedly dropped because of this.

Fix this by masking out the upper 16 bits of param2.

Fixes b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
---
 drivers/rpmsg/qcom_glink_native.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/rpmsg/qcom_glink_native.c +2 -1
index 0b2f290069080..b534b88db3f8e 100644
@@ -1204,7 +1204,8 @@ void qcom_glink_native_rx(struct qcom_glink *glink)
 			ret = qcom_glink_rx_open_ack(glink, param1);
 			break;
 		case GLINK_CMD_OPEN:
-			ret = qcom_glink_rx_defer(glink, param2);
+			/* upper 16 bits of param2 are the "prio" field */
+			ret = qcom_glink_rx_defer(glink, param2 & 0xffff);
 			break;
 		case GLINK_CMD_TX_DATA:
 		case GLINK_CMD_TX_DATA_CONT:
Signature · 1 line
2.45.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Jonathan Marek

The name len field of the CMD_OPEN packet is only 16-bits and the upper 16-bits of "param2" are a different "prio" field, which can be nonzero in certain situations, and CMD_OPEN packets can be unexpectedly dropped because of this.

Quoted 8 lines

Fix this by masking out the upper 16 bits of param2.

Fixes b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
---
 drivers/rpmsg/qcom_glink_native.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry