提交 95e3b24c 编写于 作者: H Herbert Xu 提交者: David S. Miller

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: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e125646a
...@@ -2212,10 +2212,10 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data, ...@@ -2212,10 +2212,10 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
return 0; return 0;
next_skb: next_skb:
block_limit = skb_headlen(st->cur_skb); block_limit = skb_headlen(st->cur_skb) + st->stepped_offset;
if (abs_offset < block_limit) { if (abs_offset < block_limit) {
*data = st->cur_skb->data + abs_offset; *data = st->cur_skb->data + (abs_offset - st->stepped_offset);
return block_limit - abs_offset; return block_limit - abs_offset;
} }
...@@ -2257,6 +2257,7 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data, ...@@ -2257,6 +2257,7 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
} else if (st->root_skb == st->cur_skb && } else if (st->root_skb == st->cur_skb &&
skb_shinfo(st->root_skb)->frag_list) { skb_shinfo(st->root_skb)->frag_list) {
st->cur_skb = skb_shinfo(st->root_skb)->frag_list; st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
st->frag_idx = 0;
goto next_skb; goto next_skb;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册