The header check of a received BAR channel message copies the 16-bit<br />module_id field into a uint8_t local before comparing it with the<br />handler table size, and the callers then index<br />zxdh_msg_recv_func_tbl[] with the full untruncated value. Any<br />module_id whose low byte is below ZXDH_BAR_MSG_MODULE_NUM passes the<br />check, so a sender can select among about 25,500 slots past the<br />100-entry table, and a synchronous message makes the PF call whatever<br />word it finds there. With the default gcc build the reachable slots<br />inside g_seqid_ring hold small integers set at init, so one forged<br />message from a VF jumps to a low address and kills the PF process.<br /> <br />Widen the local to uint16_t and drop the (uint8_t) cast so the check<br />compares the same value the callers use as the index. This is the<br />only place a received module_id is validated; the send side already<br />compares the full value. Valid ids 0-99 are unaffected.<br /> <br />Fixes: 3630ac8bd81f ("net/zxdh: configure interrupt")<br />Cc: stable@dpdk.org<br /> <br />Signed-off-by: Junlong Wang <wang.junlong1@zte.com.cn> <br />---<br /> drivers/net/zxdh/zxdh_msg.c | 4 ++--<br /> 1 file changed, 2 insertions(+), 2 deletions(-)<br /> <br />diff --git a/drivers/net/zxdh/zxdh_msg.c b/drivers/net/zxdh/zxdh_msg.c<br />index 95b2f5a60b..77b8df2f12 100644<br />--- a/drivers/net/zxdh/zxdh_msg.c<br />+++ b/drivers/net/zxdh/zxdh_msg.c<br />@@ -960,7 +960,7 @@ static uint16_t<br /> zxdh_bar_chan_msg_header_check(struct zxdh_bar_msg_header *msg_header)<br /> {<br />     uint16_t len = 0;<br />-    uint8_t module_id = 0;<br />+    uint16_t module_id = 0;<br />  <br />     if (msg_header->valid != ZXDH_BAR_MSG_CHAN_USED) {<br />         PMD_MSG_LOG(ERR, "recv header ERR: valid label is not used");<br />@@ -968,7 +968,7 @@ zxdh_bar_chan_msg_header_check(struct zxdh_bar_msg_header *msg_header)<br />     }<br />     module_id = msg_header->module_id;<br />  <br />-    if (module_id >= (uint8_t)ZXDH_BAR_MSG_MODULE_NUM) {<br />+    if (module_id >= ZXDH_BAR_MSG_MODULE_NUM) {<br />         PMD_MSG_LOG(ERR, "recv header ERR: invalid module_id: %u", module_id);<br />         return ZXDH_BAR_MSG_ERR_MODULE;<br />     }<br />--  <br />2.27.0<br />