netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sunil Kovvuri <sunil.kovvuri@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Sunil Goutham <sgoutham@marvell.com>,
	Geetha sowjanya <gakula@marvell.com>,
	Subbaraya Sundeep <sbhatta@marvell.com>,
	hariprasad <hkelam@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Linux Netdev List <netdev@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net] octeontx2-pf: fix a buffer overflow in otx2_set_rxfh_context()
Date: Wed, 12 May 2021 15:54:28 +0530	[thread overview]
Message-ID: <CA+sq2Ce0yA1Deh=q_Ne0qNGebwmGOfnMmV75_foKxbXnPnXOwA@mail.gmail.com> (raw)
In-Reply-To: <YJup3/Ih2vIOXK2R@mwanda>

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>

  reply	other threads:[~2021-05-12 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-05-12 21:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+sq2Ce0yA1Deh=q_Ne0qNGebwmGOfnMmV75_foKxbXnPnXOwA@mail.gmail.com' \
    --to=sunil.kovvuri@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).