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-next>] [day] [month] [year] [list]
Message-Id: <20230506021529.396812-1-chenh@yusur.tech>
Date: Sat,  6 May 2023 10:15:29 +0800
From: Hao Chen <chenh@...ur.tech>
To: "Michael S. Tsirkin" <mst@...hat.com>,
	Jason Wang <jasowang@...hat.com>,
	Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	virtualization@...ts.linux-foundation.org (open list:VIRTIO CORE AND NET DRIVERS),
	netdev@...r.kernel.org (open list:NETWORKING DRIVERS),
	linux-kernel@...r.kernel.org (open list)
Cc: huangml@...ur.tech,
	zy@...ur.tech
Subject: [PATCH] virtio_net: set default mtu to 1500 when 'Device maximum MTU' bigger than 1500

When VIRTIO_NET_F_MTU(3) Device maximum MTU reporting is supported.
If offered by the device, device advises driver about the value of its
maximum MTU. If negotiated, the driver uses mtu as the maximum
MTU value. But there the driver also uses it as default mtu,
some devices may have a maximum MTU greater than 1500, this may
cause some large packages to be discarded, so I changed the MTU to a more
general 1500 when 'Device maximum MTU' bigger than 1500.

Signed-off-by: Hao Chen <chenh@...ur.tech>
---
 drivers/net/virtio_net.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 8d8038538fc4..e71c7d1b5f29 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev)
 			goto free;
 		}
 
-		dev->mtu = mtu;
+		if (mtu > 1500)
+			dev->mtu = 1500;
+		else
+			dev->mtu = mtu;
 		dev->max_mtu = mtu;
 	}
 
-- 
2.27.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ