net/mlx4: fix RSS resource leak in case of error

When memory cannot be allocated for a flow rule, its RSS context reference
is not dropped.

Fixes: 078b8b452e ("net/mlx4: add RSS flow rule action support")
Cc: stable@dpdk.org

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Adrien Mazarguil 2018-04-19 12:07:25 +02:00 committed by Ferruh Yigit
parent 7bd0994f01
commit cb43322fbd

View File

@ -820,11 +820,14 @@ mlx4_flow_prepare(struct priv *priv,
},
};
if (!mlx4_zmallocv(__func__, vec, RTE_DIM(vec)))
if (!mlx4_zmallocv(__func__, vec, RTE_DIM(vec))) {
if (temp.rss)
mlx4_rss_put(temp.rss);
return rte_flow_error_set
(error, -rte_errno,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"flow rule handle allocation failure");
}
/* Most fields will be updated by second pass. */
*flow = (struct rte_flow){
.ibv_attr = temp.ibv_attr,