zxdh_bar_msg_ack_async_msg_proc() indexes the 256-entry<br />g_seqid_ring.reps_info_tbl[] with the 16-bit msg_id taken straight<br />from the message header a VF writes into the PF/VF window. Nothing on<br />the receive path compares it with ZXDH_BAR_SEQID_NUM_MAX, so a forged<br />asynchronous ack with an out-of-range msg_id makes the PF read, and<br />under some conditions write, up to 1 MiB past the table, crashing the<br />process that drives the PF.<br /> <br />Reject msg_id >= ZXDH_BAR_SEQID_NUM_MAX before the slot pointer is<br />formed: the id is logged as invalid and the message dropped, like an<br />id that is already released. The driver only ever allocates ids below<br />256, so a well-formed peer is unaffected.<br /> <br />Apply the same comparison in zxdh_bar_chan_sync_msg_reps_get(), which<br />indexes the same table with the msg_id of a reply; that path is not<br />reachable from a VF today, the check is hardening.<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 | 5 +++++<br /> 1 file changed, 5 insertions(+)<br /> <br />diff --git a/drivers/net/zxdh/zxdh_msg.c b/drivers/net/zxdh/zxdh_msg.c<br />index 77b8df2f12..5e4085e4fa 100644<br />--- a/drivers/net/zxdh/zxdh_msg.c<br />+++ b/drivers/net/zxdh/zxdh_msg.c<br />@@ -703,6 +703,11 @@ zxdh_bar_chan_sync_msg_reps_get(uint64_t subchan_addr,<br />  <br />     zxdh_bar_chan_msg_header_get(subchan_addr, &msg_header);<br />     msg_id = msg_header.msg_id;<br />+    if (msg_id >= ZXDH_BAR_SEQID_NUM_MAX) {<br />+        PMD_MSG_LOG(ERR, "msg_id %u is invalid", msg_id);<br />+        return ZXDH_BAR_MSG_ERR_REPLY;<br />+    }<br />+<br />     struct zxdh_seqid_item *reps_info = &g_seqid_ring.reps_info_tbl[msg_id];<br />  <br />     if (reps_info->flag != ZXDH_REPS_INFO_FLAG_USED) {<br />--  <br />2.27.0<br />