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: <1284985739.3420.284.camel@edumazet-laptop>
Date:	Mon, 20 Sep 2010 14:28:59 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Amit Salecha <amit.salecha@...gic.com>
Cc:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	Ameen Rahman <ameen.rahman@...gic.com>,
	Anirban Chakraborty <anirban.chakraborty@...gic.com>,
	David Miller <davem@...emloft.net>
Subject: [PATCH net-next-2.6] qlnic: dont set skb->truesize

Le lundi 20 septembre 2010 à 14:18 +0200, Eric Dumazet a écrit :
> Le lundi 20 septembre 2010 à 06:16 -0500, Amit Salecha a écrit :
> 
> > This can be cleaned up. 
> > Though I have one doubt. We are allocating larger packets than the actual data used.
> > Doesn't it will break accounting ?
> 
> truesize accounts for the real size of buffers, not the used part in
> them.
> 
> IMHO, a driver not dealing with fragments should not touch skb->truesize
> 
> # grep truesize drivers/net/tg3.c
> <nothing>
> 
> If a driver deals with fragments, it probably should use "+=" operator
> only, not hardcoding sizeof(struct sk_buff) thing that only core network
> has to deal with.
> 
> $ find drivers/net/bnx2x|xargs grep truesize
> drivers/net/bnx2x/bnx2x_cmn.c:		skb->truesize += frag_len;
> 
> Almost all drivers are fine, they are some of them that should be
> changed.
> 
> 

I suspect following patch should be fine :

[PATCH net-next-2.6] qlnic: dont set skb->truesize

skb->truesize is set in core network.

Dont change it unless dealing with fragments.

Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
---
 drivers/net/qlcnic/qlcnic_init.c |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index e26fa95..16dd9eb 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -1418,8 +1418,6 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
 	if (pkt_offset)
 		skb_pull(skb, pkt_offset);
 
-	skb->truesize = skb->len + sizeof(struct sk_buff);
-
 	if (unlikely(qlcnic_check_rx_tagging(adapter, skb, &vid))) {
 		adapter->stats.rxdropped++;
 		dev_kfree_skb(skb);
@@ -1491,8 +1489,6 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
 
 	skb_put(skb, lro_length + data_offset);
 
-	skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb);
-
 	skb_pull(skb, l2_hdr_offset);
 
 	if (unlikely(qlcnic_check_rx_tagging(adapter, skb, &vid))) {
@@ -1732,8 +1728,6 @@ qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
 	if (pkt_offset)
 		skb_pull(skb, pkt_offset);
 
-	skb->truesize = skb->len + sizeof(struct sk_buff);
-
 	if (!qlcnic_check_loopback_buff(skb->data))
 		adapter->diag_cnt++;
 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ