Skip to content

Commit

Permalink
net: Fix off-by-one in skb_dma_map
Browse files Browse the repository at this point in the history
The unwind loop iterates down to -1 instead of stopping at 0 and ends up
accessing ->frags[-1].

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dimitris Michailidis authored and David S. Miller committed Oct 13, 2008
1 parent c6dcb82 commit ab396eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/skb_dma_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int skb_dma_map(struct device *dev, struct sk_buff *skb,
return 0;

unwind:
while (i-- >= 0) {
while (--i >= 0) {
skb_frag_t *fp = &sp->frags[i];

dma_unmap_page(dev, sp->dma_maps[i + 1],
Expand Down

0 comments on commit ab396eb

Please sign in to comment.