lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 27 Jul 2023 10:31:07 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Alexander H Duyck <alexander.duyck@...il.com>, Yuanjun Gong
	 <ruc_gongyuanjun@....com>, kuniyu@...zon.com
Cc: ajit.khaparde@...adcom.com, netdev@...r.kernel.org, 
	somnath.kotur@...adcom.com, sriharsha.basavapatna@...adcom.com
Subject: Re: [PATCH net v2 1/1] benet: fix return value check in
 be_lancer_xmit_workarounds()

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ