netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Alexander H Duyck <alexander.duyck@gmail.com>,
	Yuanjun Gong <ruc_gongyuanjun@163.com>,
	kuniyu@amazon.com
Cc: ajit.khaparde@broadcom.com, netdev@vger.kernel.org,
	 somnath.kotur@broadcom.com, sriharsha.basavapatna@broadcom.com
Subject: Re: [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds()
Date: Thu, 27 Jul 2023 10:31:07 +0200	[thread overview]
Message-ID: <661fb9b145434daeca70accfdee3c3a6f8b3787b.camel@redhat.com> (raw)
In-Reply-To: <8a5c57dd26f70399a3db012884c2ccb090b00dba.camel@gmail.com>

On Tue, 2023-07-25 at 11:00 -0700, Alexander H Duyck wrote:
> On Tue, 2023-07-25 at 11:27 +0800, Yuanjun Gong wrote:
> > in be_lancer_xmit_workarounds(), it should go to label 'tx_drop'
> > if an unexpected value is returned by pskb_trim().
> > 
> > Fixes: 93040ae5cc8d ("be2net: Fix to trim skb for padded vlan packets to workaround an ASIC Bug")
> > Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> > ---
> >  drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
> > index 18c2fc880d09..0616b5fe241c 100644
> > --- a/drivers/net/ethernet/emulex/benet/be_main.c
> > +++ b/drivers/net/ethernet/emulex/benet/be_main.c
> > @@ -1138,7 +1138,8 @@ static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter,
> >  	    (lancer_chip(adapter) || BE3_chip(adapter) ||
> >  	     skb_vlan_tag_present(skb)) && is_ipv4_pkt(skb)) {
> >  		ip = (struct iphdr *)ip_hdr(skb);
> > -		pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len));
> > +		if (unlikely(pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len))))
> > +			goto tx_drop;
> >  	}
> >  
> >  	/* If vlan tag is already inlined in the packet, skip HW VLAN
> 
> I'm not sure dropping the packet is the right solution here. Based on
> the description of the issue that this is a workaround for it might
> make more sense to simply put out a WARN based on the failure since it
> means that the tot_len field in the IP header will be modified
> incorrectly and a bad IPv4 checksum will be inserted.

... which in turn means the packet will be dropped later, right?

Then I guess it's better to drop it now, it requires a similar amount
of code and will reduce resources usage all around.

Cheers,

Paolo


  reply	other threads:[~2023-07-27  8:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 14:45 [PATCH 1/1] drivers:net: fix return value check in be_lancer_xmit_workarounds Yuanjun Gong
2023-07-17 19:32 ` Kuniyuki Iwashima
2023-07-19 20:16   ` Simon Horman
2023-07-25  3:27   ` [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds() Yuanjun Gong
2023-07-25 18:00     ` Alexander H Duyck
2023-07-27  8:31       ` Paolo Abeni [this message]
2023-07-27  8:50     ` 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=661fb9b145434daeca70accfdee3c3a6f8b3787b.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=alexander.duyck@gmail.com \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=ruc_gongyuanjun@163.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=sriharsha.basavapatna@broadcom.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).