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: <20240712080329.197605-2-jean-philippe@linaro.org>
Date: Fri, 12 Jul 2024 09:03:30 +0100
From: Jean-Philippe Brucker <jean-philippe@...aro.org>
To: mst@...hat.com,
	jasowang@...hat.com,
	xuanzhuo@...ux.alibaba.com,
	eperezma@...hat.com
Cc: davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com,
	virtualization@...ts.linux.dev,
	netdev@...r.kernel.org,
	Jean-Philippe Brucker <jean-philippe@...aro.org>,
	Aishwarya TCV <aishwarya.tcv@....com>
Subject: [PATCH net-next] net: virtio: fix virtnet_sq_free_stats initialization

Commit c8bd1f7f3e61 ("virtio_net: add support for Byte Queue Limits")
added two new fields to struct virtnet_sq_free_stats, but commit
23c81a20b998 ("net: virtio: unify code to init stats") accidentally
removed their initialization. In the worst case this can trigger the BUG
at lib/dynamic_queue_limits.c:99 because dql_completed() receives a
random value as count. Initialize the whole structure.

Fixes: 23c81a20b998 ("net: virtio: unify code to init stats")
Reported-by: Aishwarya TCV <aishwarya.tcv@....com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@...aro.org>
---
Both these patches are still in next so it might be possible to fix it
up directly.
---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 10d8674eec5d2..f014802522e0f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -530,7 +530,7 @@ static void __free_old_xmit(struct send_queue *sq, struct netdev_queue *txq,
 	unsigned int len;
 	void *ptr;
 
-	stats->bytes = stats->packets = 0;
+	memset(stats, 0, sizeof(*stats));
 
 	while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) {
 		if (!is_xdp_frame(ptr)) {

base-commit: 3fe121b622825ff8cc995a1e6b026181c48188db
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ