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]
Date:   Thu, 22 Apr 2021 16:50:50 +0300
From:   Ido Schimmel <idosch@...sch.org>
To:     netdev@...r.kernel.org
Cc:     davem@...emloft.net, kuba@...nel.org, mlxsw@...dia.com,
        Ido Schimmel <idosch@...dia.com>
Subject: [PATCH net-next] netdevsim: Only use sampling truncation length when valid

From: Ido Schimmel <idosch@...dia.com>

When the sampling truncation length is invalid (zero), pass the length
of the packet. Without the fix, no payload is reported to user space
when the truncation length is zero.

Fixes: a8700c3dd0a4 ("netdevsim: Add dummy psample implementation")
Signed-off-by: Ido Schimmel <idosch@...dia.com>
---
 drivers/net/netdevsim/psample.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/netdevsim/psample.c b/drivers/net/netdevsim/psample.c
index 5ec3bd7f891b..f0c6477dd0ae 100644
--- a/drivers/net/netdevsim/psample.c
+++ b/drivers/net/netdevsim/psample.c
@@ -79,9 +79,10 @@ static struct sk_buff *nsim_dev_psample_skb_build(void)
 }
 
 static void nsim_dev_psample_md_prepare(const struct nsim_dev_psample *psample,
-					struct psample_metadata *md)
+					struct psample_metadata *md,
+					unsigned int len)
 {
-	md->trunc_size = psample->trunc_size;
+	md->trunc_size = psample->trunc_size ? psample->trunc_size : len;
 	md->in_ifindex = psample->in_ifindex;
 	md->out_ifindex = psample->out_ifindex;
 
@@ -120,7 +121,7 @@ static void nsim_dev_psample_report_work(struct work_struct *work)
 	if (!skb)
 		goto out;
 
-	nsim_dev_psample_md_prepare(psample, &md);
+	nsim_dev_psample_md_prepare(psample, &md, skb->len);
 	psample_sample_packet(psample->group, skb, psample->rate, &md);
 	consume_skb(skb);
 
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ