diff mbox

netxen: dont set skb->truesize

Message ID 1285098910.2452.9.camel@edumazet-laptop
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Sept. 21, 2010, 7:55 p.m. UTC
Le mardi 21 septembre 2010 à 12:33 -0700, David Miller a écrit :
> From: Amit Salecha <amit.salecha@qlogic.com>
> Date: Tue, 21 Sep 2010 03:41:42 -0500
> 
> >> So in order to improve "throughput", you were allowing for memory
> >> exhaust and freeze of the _machine_ ?
> >>
> > This won't lead to such problem. truesize is used for accounting only.
> 
> Yes, it will.
> 
> Do you understand that we enforce both socket-level and system-wide
> networking buffer usage in the stack?  And this limiting is based
> upon skb->truesize and therefore only works if skb->truesize is
> accurate?
> 
> It's meant to keep people from attacking a server and consuming large
> percentages of system memory with networking buffer memory such that
> other tasks cannot complete successfully.
> 
> And by mis-reporting the truesize you are subverting that entirely.
> 
> This qlcnic truesize bug is a huge security hole, can't you see this
> now?
> 

BTW, drivers/net/netxen/netxen_nic_init.c has same problem.

[PATCH] netxen: 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@gmail.com>
---
 drivers/net/netxen/netxen_nic_init.c |    3 ---
 1 file changed, 3 deletions(-)



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

Comments

David Miller Sept. 21, 2010, 8:04 p.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 21 Sep 2010 21:55:10 +0200

> BTW, drivers/net/netxen/netxen_nic_init.c has same problem.
> 
> [PATCH] netxen: dont set skb->truesize

Applied to net-2.6, and I backported the qlcnic patch in net-next-2.6
into net-2.6 too.

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

Patch

diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index cabae7b..b075a35 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1540,7 +1540,6 @@  netxen_process_rcv(struct netxen_adapter *adapter,
 	if (pkt_offset)
 		skb_pull(skb, pkt_offset);
 
-	skb->truesize = skb->len + sizeof(struct sk_buff);
 	skb->protocol = eth_type_trans(skb, netdev);
 
 	napi_gro_receive(&sds_ring->napi, skb);
@@ -1602,8 +1601,6 @@  netxen_process_lro(struct netxen_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);
 	skb->protocol = eth_type_trans(skb, netdev);