From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: amit.salecha@qlogic.com, netdev@vger.kernel.org,
ameen.rahman@qlogic.com, anirban.chakraborty@qlogic.com
Subject: Re: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
Date: Fri, 17 Sep 2010 22:58:24 -0700 (PDT) [thread overview]
Message-ID: <20100917.225824.193719467.davem@davemloft.net> (raw)
In-Reply-To: <1284717448.3391.75.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 17 Sep 2010 11:57:28 +0200
> [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
>
> qlcnic driver allocates rx skbs and gives to hardware too bytes of extra
> storage, allowing for corruption of kernel data.
>
> NET_IP_ALIGN being 0 on some platforms (including x86), drivers should
> not assume it's 2.
>
> rds_ring->skb_size = rds_ring->dma_size + NET_IP_ALIGN;
> ...
> skb = dev_alloc_skb(rds_ring->skb_size);
> skb_reserve(skb, 2);
> pci_map_single(pdev, skb->data, rds_ring->dma_size, PCI_DMA_FROMDEVICE);
>
> (and rds_ring->skb_size == rds_ring->dma_size) -> bug
>
>
> Because of extra alignment (1500 + 32) -> four extra bytes are available
> before the struct skb_shared_info, so corruption is not noticed.
>
> Note: this driver could use netdev_alloc_skb_ip_align()
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied to net-2.6, thanks Eric.
next prev parent reply other threads:[~2010-09-18 5:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-17 5:14 [PATCHv2 NEXT 0/5]qlcnic: vlan rx accleration support Amit Kumar Salecha
2010-09-17 5:14 ` [PATCHv2 NEXT 1/5] qlcnic: support vlan rx accleration Amit Kumar Salecha
2010-09-17 5:29 ` Eric Dumazet
2010-09-17 9:57 ` [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2 Eric Dumazet
2010-09-17 10:53 ` Amit Salecha
2010-09-18 5:58 ` David Miller [this message]
2010-09-20 11:16 ` Amit Salecha
2010-09-20 12:18 ` Eric Dumazet
2010-09-20 12:28 ` [PATCH net-next-2.6] qlnic: dont set skb->truesize Eric Dumazet
2010-09-20 17:09 ` David Miller
2010-09-20 15:58 ` [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2 David Miller
2010-09-21 8:19 ` Amit Salecha
2010-09-21 8:34 ` Eric Dumazet
2010-09-21 8:41 ` Amit Salecha
2010-09-21 9:23 ` Eric Dumazet
2010-09-21 19:33 ` David Miller
2010-09-21 19:55 ` [PATCH] netxen: dont set skb->truesize Eric Dumazet
2010-09-21 20:04 ` David Miller
2010-09-17 5:14 ` [PATCHv2 NEXT 2/5] qlcnic: vlan gro support Amit Kumar Salecha
2010-09-17 18:24 ` David Miller
2010-09-17 18:25 ` David Miller
2010-09-17 5:14 ` [PATCHv2 NEXT 3/5] qlcnic: vlan lro support Amit Kumar Salecha
2010-09-17 5:14 ` [PATCHv2 NEXT 4/5] qlcnic: remove fw version check Amit Kumar Salecha
2010-09-17 5:14 ` [PATCHv2 NEXT 5/5] qlcnic: update version 5.0.10 Amit Kumar Salecha
2010-09-17 18:31 ` [PATCHv2 NEXT 0/5]qlcnic: vlan rx accleration support David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100917.225824.193719467.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=ameen.rahman@qlogic.com \
--cc=amit.salecha@qlogic.com \
--cc=anirban.chakraborty@qlogic.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).