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]
Message-ID:
 <PAXPR04MB85107C52F0CB3A45943FBEF5883EA@PAXPR04MB8510.eurprd04.prod.outlook.com>
Date: Mon, 25 Aug 2025 02:13:01 +0000
From: Wei Fang <wei.fang@....com>
To: Shenwei Wang <shenwei.wang@....com>
CC: Clark Wang <xiaoning.wang@....com>, Stanislav Fomichev <sdf@...ichev.me>,
	"imx@...ts.linux.dev" <imx@...ts.linux.dev>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, dl-linux-imx <linux-imx@....com>, Andrew Lunn
	<andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
	<pabeni@...hat.com>, Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann
	<daniel@...earbox.net>, Jesper Dangaard Brouer <hawk@...nel.org>, John
 Fastabend <john.fastabend@...il.com>
Subject: RE: [PATCH v2 net-next 4/5] net: fec: add change_mtu to support
 dynamic buffer allocation

> > > +static int fec_change_mtu(struct net_device *ndev, int new_mtu) {
> > > +	struct fec_enet_private *fep = netdev_priv(ndev);
> > > +	int order, done;
> > > +	bool running;
> > > +
> > > +	order = get_order(new_mtu + ETH_HLEN + ETH_FCS_LEN);
> > > +	if (fep->pagepool_order == order) {
> > > +		WRITE_ONCE(ndev->mtu, new_mtu);
> > > +		return 0;
> > > +	}
> > > +
> > > +	fep->pagepool_order = order;
> > > +	fep->rx_frame_size = (PAGE_SIZE << order) -
> > FEC_ENET_XDP_HEADROOM
> > > +			     - SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
> > > +
> >
> > I think we need to add a check for rx_frame_size, as FEC_R_CNTRL[MAX_FL]
> and
> > FEC_FTRL[TRUNC_FL] only have 14 bits.
> 
> That would be redundant, since rx_frame_size cannot exceed max_buf_size
> which value
> would either be PKT_MAXBUF_SIZE or MAX_JUMBO_BUF_SIZE.
> 

Looked at the entire patch set, the rx_frame_size is set to FEC_FTRL[TRUNC_FL]
and FEC_R_CNTRL[MAX_FL], and both TRUNC_FL and MAX_FL are 14 bits, if the
value set exceeds the hardware capability, the driver should return an error.

For example, the order is 3, so rx_frame_size is 0x7dc0, but MAX_FL will be set
to 0x3dc0, that is not correct.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ