net: hns3: Fix an error handling path in 'hclge_rss_init_hw()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 30 Sep 2017 05:34:34 +0000 (07:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Oct 2017 05:57:24 +0000 (22:57 -0700)
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>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

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