Browse Source

net: hns3: Fix an error handling path in 'hclge_rss_init_hw()'

If this sanity check fails, we must free 'rss_indir'. Otherwise there is a
memory leak.
'goto err' as done in the other error handling paths to fix it.

Fixes: 46a3df9f9718 ("net: hns3: Fix for setting rss_size incorrectly")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christophe JAILLET 7 years ago
parent
commit
81359617f1
1 changed files with 2 additions and 1 deletions
  1. 2 1
      drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

+ 2 - 1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

@@ -2652,7 +2652,8 @@ static int hclge_rss_init_hw(struct hclge_dev *hdev)
 		dev_err(&hdev->pdev->dev,
 		dev_err(&hdev->pdev->dev,
 			"Configure rss tc size failed, invalid TC_SIZE = %d\n",
 			"Configure rss tc size failed, invalid TC_SIZE = %d\n",
 			rss_size);
 			rss_size);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err;
 	}
 	}
 
 
 	roundup_size = roundup_pow_of_two(rss_size);
 	roundup_size = roundup_pow_of_two(rss_size);