All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: hns3: Fix an error handling path in 'hclge_rss_init_hw()'
@ 2017-09-30  5:34 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2017-09-30  5:34 UTC (permalink / raw)
  To: yisen.zhuang, salil.mehta, davem, linyunsheng, lipeng321,
	colin.king, arnd
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

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>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index e0685e630afe..c1cdbfd83bdb 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/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,
 			"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);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] net: hns3: Fix an error handling path in 'hclge_rss_init_hw()'
@ 2017-09-30  5:34 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2017-09-30  5:34 UTC (permalink / raw)
  To: yisen.zhuang, salil.mehta, davem, linyunsheng, lipeng321,
	colin.king, arnd
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

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>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index e0685e630afe..c1cdbfd83bdb 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/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,
 			"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);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: hns3: Fix an error handling path in 'hclge_rss_init_hw()'
  2017-09-30  5:34 ` Christophe JAILLET
@ 2017-09-30  6:10   ` Yunsheng Lin
  -1 siblings, 0 replies; 6+ messages in thread
From: Yunsheng Lin @ 2017-09-30  6:10 UTC (permalink / raw)
  To: Christophe JAILLET, yisen.zhuang, salil.mehta, davem, lipeng321,
	colin.king, arnd
  Cc: netdev, linux-kernel, kernel-janitors

Hi, Christophe

On 2017/9/30 13:34, Christophe JAILLET wrote:
> 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.

Thanks for fixing.

> 
> Fixes: 46a3df9f9718 ("net: hns3: Fix for setting rss_size incorrectly")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> index e0685e630afe..c1cdbfd83bdb 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> +++ b/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,
>  			"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);
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: hns3: Fix an error handling path in 'hclge_rss_init_hw()'
@ 2017-09-30  6:10   ` Yunsheng Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Yunsheng Lin @ 2017-09-30  6:10 UTC (permalink / raw)
  To: Christophe JAILLET, yisen.zhuang, salil.mehta, davem, lipeng321,
	colin.king, arnd
  Cc: netdev, linux-kernel, kernel-janitors

Hi, Christophe

On 2017/9/30 13:34, Christophe JAILLET wrote:
> 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.

Thanks for fixing.

> 
> Fixes: 46a3df9f9718 ("net: hns3: Fix for setting rss_size incorrectly")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> index e0685e630afe..c1cdbfd83bdb 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> +++ b/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,
>  			"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);
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: hns3: Fix an error handling path in 'hclge_rss_init_hw()'
  2017-09-30  5:34 ` Christophe JAILLET
@ 2017-10-02  5:57   ` David Miller
  -1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-10-02  5:57 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: yisen.zhuang, salil.mehta, linyunsheng, lipeng321, colin.king,
	arnd, netdev, linux-kernel, kernel-janitors

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sat, 30 Sep 2017 07:34:34 +0200

> 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>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: hns3: Fix an error handling path in 'hclge_rss_init_hw()'
@ 2017-10-02  5:57   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-10-02  5:57 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: yisen.zhuang, salil.mehta, linyunsheng, lipeng321, colin.king,
	arnd, netdev, linux-kernel, kernel-janitors

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sat, 30 Sep 2017 07:34:34 +0200

> 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>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-02  5:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-30  5:34 [PATCH] net: hns3: Fix an error handling path in 'hclge_rss_init_hw()' Christophe JAILLET
2017-09-30  5:34 ` Christophe JAILLET
2017-09-30  6:10 ` Yunsheng Lin
2017-09-30  6:10   ` Yunsheng Lin
2017-10-02  5:57 ` David Miller
2017-10-02  5:57   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.