提交 ab396eb0 编写于 作者: D Dimitris Michailidis 提交者: David S. Miller

net: Fix off-by-one in skb_dma_map

The unwind loop iterates down to -1 instead of stopping at 0 and ends up
accessing ->frags[-1].
Signed-off-by: NDimitris Michailidis <dm@chelsio.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c6dcb827
...@@ -35,7 +35,7 @@ int skb_dma_map(struct device *dev, struct sk_buff *skb, ...@@ -35,7 +35,7 @@ int skb_dma_map(struct device *dev, struct sk_buff *skb,
return 0; return 0;
unwind: unwind:
while (i-- >= 0) { while (--i >= 0) {
skb_frag_t *fp = &sp->frags[i]; skb_frag_t *fp = &sp->frags[i];
dma_unmap_page(dev, sp->dma_maps[i + 1], dma_unmap_page(dev, sp->dma_maps[i + 1],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册