zxdh_hw_flow_query() declares its ZXDH_DTB_USER_ENTRY_T without an<br />initialiser, unlike the sibling declarations in<br />zxdh_hw_flow_insert() and zxdh_hw_flow_del() which use = {0}. When<br />the flow index is ZXDH_MAX_FLOW_NUM or more,<br />zxdh_fd_flow_to_dtbentry() returns before writing the entry, and the<br />free_res path then calls rte_free() on the uninitialised<br />p_entry_data pointer. The index comes from a VF's ZXDH_FLOW_HW_GET<br />mailbox message, and pf_fd_hw_query_count() only checks it after the<br />query, so a single request from a guest frees garbage and kills the<br />process driving the PF in a release build.<br /> <br />Initialise the entry the way the siblings do: both error paths<br />(out-of-range index and rte_zmalloc() failure) then end in<br />rte_free(NULL), a no-op, and the VF gets the existing error reply.<br />Valid indices behave as before.<br /> <br />Fixes: d0af48c1b952 ("net/zxdh: support flow API")<br />Cc: stable@dpdk.org<br /> <br />Signed-off-by: Junlong Wang <wang.junlong1@zte.com.cn> <br />---<br /> drivers/net/zxdh/zxdh_flow.c | 2 +-<br /> 1 file changed, 1 insertion(+), 1 deletion(-)<br /> <br />diff --git a/drivers/net/zxdh/zxdh_flow.c b/drivers/net/zxdh/zxdh_flow.c<br />index 56ac34c6e3..a51ce9ef77 100644<br />--- a/drivers/net/zxdh/zxdh_flow.c<br />+++ b/drivers/net/zxdh/zxdh_flow.c<br />@@ -1137,7 +1137,7 @@ zxdh_hw_flow_query(struct rte_eth_dev *dev, struct zxdh_flow *dh_flow,<br />     struct zxdh_hw *hw = dev->data->dev_private;<br />     int ret = 0;<br />     struct zxdh_flow_info *flow = &dh_flow->flowentry;<br />-    ZXDH_DTB_USER_ENTRY_T dtb_entry;<br />+    ZXDH_DTB_USER_ENTRY_T dtb_entry = {0};<br />     uint16_t handle_idx;<br />  <br />     handle_idx = zxdh_fd_flow_to_dtbentry(hw, flow, &dtb_entry);<br />--  <br />2.27.0<br />