Skip to contentSkip to conversation

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

PATCH Superseded Jonathan Marek 2 participants 4 messages Oct 7, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 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.

(the commit in this Fixes tag is not where the original code was introduced but it should be far back enough not to matter)

Fixes 835764ddd9af ("rpmsg: glink: Move the common glink protocol implementation to glink_native.c")
---
 drivers/rpmsg/qcom_glink_native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rpmsg/qcom_glink_native.c +1 -1
index 0b2f290069080..e4933b823238c 100644
@@ -1204,7 +1204,7 @@ 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);
+			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
#1 lore raw
Quoted 4 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 field, which can be nonzero in certain situations, and CMD_OPEN packets can be unexpectedly dropped because of this.

Any idea about the upper 16 bits? Should we care about that data too?

Quoted 5 lines

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

(the commit in this Fixes tag is not where the original code was introduced but it should be far back enough not to matter)

Let's be more precise:

Fixes b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
Quoted 23 lines
Fixes 835764ddd9af ("rpmsg: glink: Move the common glink protocol implementation to glink_native.c")
---
 drivers/rpmsg/qcom_glink_native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rpmsg/qcom_glink_native.c +1 -1
index 0b2f290069080..e4933b823238c 100644
@@ -1204,7 +1204,7 @@ 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);
+			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
Signature · 2 lines
With best wishes
Dmitry
#2 lore raw
Quoted 8 lines · Dmitry Baryshkov
Quoted 4 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 field, which can be nonzero in certain situations, and CMD_OPEN packets can be unexpectedly dropped because of this.

Any idea about the upper 16 bits? Should we care about that data too?

Its a "prio" value, it should be OK to ignore it.

#3 lore raw
Quoted 11 lines · Jonathan Marek
Quoted 8 lines · Dmitry Baryshkov
Quoted 4 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 field, which can be nonzero in certain situations, and CMD_OPEN packets can be unexpectedly dropped because of this.

Any idea about the upper 16 bits? Should we care about that data too?

Its a "prio" value, it should be OK to ignore it.

Could you please document it in the commit message and in a comment next to the qcom_glink_rx_defer() call?

Signature · 2 lines
With best wishes
Dmitry