diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2009-01-29 19:07:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-29 19:07:52 -0500 |
commit | 95e3b24cfb4ec0479d2c42f7a1780d68063a542a (patch) | |
tree | ae16c4b765c86fbb764a3519e4d73e6f148e6f89 /net | |
parent | e125646ab56b490d0390b158e0afa9cccfc1f897 (diff) |
net: Fix frag_list handling in skb_seq_read
The frag_list handling was broken in skb_seq_read:
1) We didn't add the stepped offset when looking at the head
are of fragments other than the first.
2) We didn't take the stepped offset away when setting the data
pointer in the head area.
3) The frag index wasn't reset.
This patch fixes both issues.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/skbuff.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 2e5f2ca3bdcd..f23fd43539ed 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2212,10 +2212,10 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data, | |||
2212 | return 0; | 2212 | return 0; |
2213 | 2213 | ||
2214 | next_skb: | 2214 | next_skb: |
2215 | block_limit = skb_headlen(st->cur_skb); | 2215 | block_limit = skb_headlen(st->cur_skb) + st->stepped_offset; |
2216 | 2216 | ||
2217 | if (abs_offset < block_limit) { | 2217 | if (abs_offset < block_limit) { |
2218 | *data = st->cur_skb->data + abs_offset; | 2218 | *data = st->cur_skb->data + (abs_offset - st->stepped_offset); |
2219 | return block_limit - abs_offset; | 2219 | return block_limit - abs_offset; |
2220 | } | 2220 | } |
2221 | 2221 | ||
@@ -2257,6 +2257,7 @@ next_skb: | |||
2257 | } else if (st->root_skb == st->cur_skb && | 2257 | } else if (st->root_skb == st->cur_skb && |
2258 | skb_shinfo(st->root_skb)->frag_list) { | 2258 | skb_shinfo(st->root_skb)->frag_list) { |
2259 | st->cur_skb = skb_shinfo(st->root_skb)->frag_list; | 2259 | st->cur_skb = skb_shinfo(st->root_skb)->frag_list; |
2260 | st->frag_idx = 0; | ||
2260 | goto next_skb; | 2261 | goto next_skb; |
2261 | } | 2262 | } |
2262 | 2263 | ||