All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Ioana Ciocoi Radulescu <ruxandra.radulescu@nxp.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	brouer@redhat.com
Subject: Re: [PATCH net] dpaa2-eth: Fix possible access beyond end of array
Date: Mon, 25 Mar 2019 12:25:57 +0100	[thread overview]
Message-ID: <20190325122557.3ae3753d@carbon> (raw)
In-Reply-To: <AM0PR04MB499443974108AE8074EAA4AF945E0@AM0PR04MB4994.eurprd04.prod.outlook.com>

On Mon, 25 Mar 2019 09:42:22 +0000
Ioana Ciocoi Radulescu <ruxandra.radulescu@nxp.com> wrote:

> > -----Original Message-----
> > From: Jesper Dangaard Brouer <brouer@redhat.com>
> > Sent: Sunday, March 24, 2019 8:29 PM
> > To: Ioana Ciocoi Radulescu <ruxandra.radulescu@nxp.com>
> > Cc: netdev@vger.kernel.org; davem@davemloft.net; Ioana Ciornei
> > <ioana.ciornei@nxp.com>; brouer@redhat.com
> > Subject: Re: [PATCH net] dpaa2-eth: Fix possible access beyond end of array
> > 
> > On Wed, 20 Mar 2019 14:11:04 +0000
> > Ioana Ciocoi Radulescu <ruxandra.radulescu@nxp.com> wrote:
> >   
> > > Make sure we don't try to enqueue XDP_REDIRECT frames to an
> > > inexistent FQ.
> > >
> > > While it is guaranteed not to have more than one queue per core,
> > > having fewer queues than CPUs on an interface is a valid
> > > configuration.
> > >
> > > Fixes: d678be1dc1ec ("dpaa2-eth: add XDP_REDIRECT support")
> > > Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > > Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
> > > ---
> > >  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c  
> > b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c  
> > > index 2ba49e9..1a68052 100644
> > > --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > > +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > > @@ -1817,7 +1817,7 @@ static int dpaa2_eth_xdp_xmit_frame(struct  
> > net_device *net_dev,  
> > >  	dpaa2_fd_set_format(&fd, dpaa2_fd_single);
> > >  	dpaa2_fd_set_ctrl(&fd, FD_CTRL_PTA);
> > >
> > > -	fq = &priv->fq[smp_processor_id()];
> > > +	fq = &priv->fq[smp_processor_id() % dpaa2_eth_queue_count(priv)];
> > >  	for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) {
> > >  		err = priv->enqueue(priv, fq, &fd, 0);  
> > 
> > Are you sure this is correct?
> > How do you guard/lock concurrent CPUs from accessing 'fq' ?  
> 
> We only use 'fq' in the enqueue command to hardware.
> Our hardware can handle concurrent enqueue commands, we
> might at most get a busy response from it.

Great, then this should be okay :-)

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

      reply	other threads:[~2019-03-25 11:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 14:11 [PATCH net] dpaa2-eth: Fix possible access beyond end of array Ioana Ciocoi Radulescu
2019-03-20 23:29 ` David Miller
2019-03-21 15:26   ` Ioana Ciocoi Radulescu
2019-03-24 18:28 ` Jesper Dangaard Brouer
2019-03-25  9:42   ` Ioana Ciocoi Radulescu
2019-03-25 11:25     ` Jesper Dangaard Brouer [this message]

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=20190325122557.3ae3753d@carbon \
    --to=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ioana.ciornei@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=ruxandra.radulescu@nxp.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 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.