* [PATCH net-next v2 1/1] af-packet: fix - avoid reading stale data
@ 2011-07-13 2:47 Chetan Loke
2011-07-14 15:36 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Chetan Loke @ 2011-07-13 2:47 UTC (permalink / raw)
To: davem, netdev; +Cc: lokechetan, eric.dumazet, Chetan Loke
Currently we flush tp_status and then flush the remainder of the header+payload.
tp_status should be flushed in the end to avoid stale data being read by user-space.
Incorrectly re-ordered barriers in v1.
Signed-off-by: Chetan Loke <loke.chetan@gmail.com>
---
net/packet/af_packet.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index d2294ad..c698cec 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1129,7 +1129,6 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
else
sll->sll_ifindex = dev->ifindex;
- __packet_set_status(po, h.raw, status);
smp_mb();
#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
{
@@ -1138,8 +1137,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
end = (u8 *)PAGE_ALIGN((unsigned long)h.raw + macoff + snaplen);
for (start = h.raw; start < end; start += PAGE_SIZE)
flush_dcache_page(pgv_to_page(start));
+ smp_wmb();
}
#endif
+ __packet_set_status(po, h.raw, status);
sk->sk_data_ready(sk, 0);
--
1.7.5.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next v2 1/1] af-packet: fix - avoid reading stale data
2011-07-13 2:47 [PATCH net-next v2 1/1] af-packet: fix - avoid reading stale data Chetan Loke
@ 2011-07-14 15:36 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-07-14 15:36 UTC (permalink / raw)
To: loke.chetan; +Cc: netdev, lokechetan, eric.dumazet
From: Chetan Loke <loke.chetan@gmail.com>
Date: Tue, 12 Jul 2011 22:47:49 -0400
> Currently we flush tp_status and then flush the remainder of the header+payload.
> tp_status should be flushed in the end to avoid stale data being read by user-space.
>
> Incorrectly re-ordered barriers in v1.
>
> Signed-off-by: Chetan Loke <loke.chetan@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-14 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-13 2:47 [PATCH net-next v2 1/1] af-packet: fix - avoid reading stale data Chetan Loke
2011-07-14 15:36 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.