netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] octeontx2-pf: fix a buffer overflow in otx2_set_rxfh_context()
@ 2021-05-12 10:11 Dan Carpenter
  2021-05-12 10:24 ` Sunil Kovvuri
  2021-05-12 21:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-05-12 10:11 UTC (permalink / raw)
  To: Sunil Goutham
  Cc: Geetha sowjanya, Subbaraya Sundeep, hariprasad, David S. Miller,
	Jakub Kicinski, netdev, kernel-janitors

This function is called from ethtool_set_rxfh() and "*rss_context"
comes from the user.  Add some bounds checking to prevent memory
corruption.

Fixes: 81a4362016e7 ("octeontx2-pf: Add RSS multi group support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index f4962a97a075..9d9a2e438acf 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -786,6 +786,10 @@ static int otx2_set_rxfh_context(struct net_device *dev, const u32 *indir,
 	if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
 		return -EOPNOTSUPP;
 
+	if (*rss_context != ETH_RXFH_CONTEXT_ALLOC &&
+	    *rss_context >= MAX_RSS_GROUPS)
+		return -EINVAL;
+
 	rss = &pfvf->hw.rss_info;
 
 	if (!rss->enable) {
-- 
2.30.2


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

* Re: [PATCH net] octeontx2-pf: fix a buffer overflow in otx2_set_rxfh_context()
  2021-05-12 10:11 [PATCH net] octeontx2-pf: fix a buffer overflow in otx2_set_rxfh_context() Dan Carpenter
@ 2021-05-12 10:24 ` Sunil Kovvuri
  2021-05-12 21:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Sunil Kovvuri @ 2021-05-12 10:24 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sunil Goutham, Geetha sowjanya, Subbaraya Sundeep, hariprasad,
	David S. Miller, Jakub Kicinski, Linux Netdev List,
	kernel-janitors

On Wed, May 12, 2021 at 3:42 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> This function is called from ethtool_set_rxfh() and "*rss_context"
> comes from the user.  Add some bounds checking to prevent memory
> corruption.
>
> Fixes: 81a4362016e7 ("octeontx2-pf: Add RSS multi group support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> index f4962a97a075..9d9a2e438acf 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> @@ -786,6 +786,10 @@ static int otx2_set_rxfh_context(struct net_device *dev, const u32 *indir,
>         if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
>                 return -EOPNOTSUPP;
>
> +       if (*rss_context != ETH_RXFH_CONTEXT_ALLOC &&
> +           *rss_context >= MAX_RSS_GROUPS)
> +               return -EINVAL;
> +
>         rss = &pfvf->hw.rss_info;
>
>         if (!rss->enable) {
> --
> 2.30.2
>

Acked-by: Sunil Goutham <sgoutham@marvell.com>

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

* Re: [PATCH net] octeontx2-pf: fix a buffer overflow in otx2_set_rxfh_context()
  2021-05-12 10:11 [PATCH net] octeontx2-pf: fix a buffer overflow in otx2_set_rxfh_context() Dan Carpenter
  2021-05-12 10:24 ` Sunil Kovvuri
@ 2021-05-12 21:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-12 21:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: sgoutham, gakula, sbhatta, hkelam, davem, kuba, netdev, kernel-janitors

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed, 12 May 2021 13:11:43 +0300 you wrote:
> This function is called from ethtool_set_rxfh() and "*rss_context"
> comes from the user.  Add some bounds checking to prevent memory
> corruption.
> 
> Fixes: 81a4362016e7 ("octeontx2-pf: Add RSS multi group support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> [...]

Here is the summary with links:
  - [net] octeontx2-pf: fix a buffer overflow in otx2_set_rxfh_context()
    https://git.kernel.org/netdev/net/c/e5cc361e2164

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-05-12 21:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 10:11 [PATCH net] octeontx2-pf: fix a buffer overflow in otx2_set_rxfh_context() Dan Carpenter
2021-05-12 10:24 ` Sunil Kovvuri
2021-05-12 21:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).