diff options
author | Ira W. Snyder <iws@ovro.caltech.edu> | 2009-01-27 00:00:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-27 00:00:33 -0500 |
commit | 8527bec548e01a29c6d1928d20d6d3be71861482 (patch) | |
tree | f5ec2235719ca1fe58431a35d3010f7cfa9ade5b /drivers/net | |
parent | 5376071069ec8a7e6a8112beab16fc24f5139475 (diff) |
virtio_net: use correct accessors for scatterlists
Without this fix, virtio_net makes incorrect usage of scatterlists. It sets
the end of the scatterlist chain after the first element, despite the fact
that more entries come after it.
If you try to run dma_map_sg() on one of the scatterlists given to you by
add_buf(), you will get a null pointer oops.
Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/virtio_net.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 63ef2a8905f..c68808336c8 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -287,7 +287,7 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi) | |||
287 | skb_put(skb, MAX_PACKET_LEN); | 287 | skb_put(skb, MAX_PACKET_LEN); |
288 | 288 | ||
289 | hdr = skb_vnet_hdr(skb); | 289 | hdr = skb_vnet_hdr(skb); |
290 | sg_init_one(sg, hdr, sizeof(*hdr)); | 290 | sg_set_buf(sg, hdr, sizeof(*hdr)); |
291 | 291 | ||
292 | if (vi->big_packets) { | 292 | if (vi->big_packets) { |
293 | for (i = 0; i < MAX_SKB_FRAGS; i++) { | 293 | for (i = 0; i < MAX_SKB_FRAGS; i++) { |
@@ -488,9 +488,9 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb) | |||
488 | 488 | ||
489 | /* Encode metadata header at front. */ | 489 | /* Encode metadata header at front. */ |
490 | if (vi->mergeable_rx_bufs) | 490 | if (vi->mergeable_rx_bufs) |
491 | sg_init_one(sg, mhdr, sizeof(*mhdr)); | 491 | sg_set_buf(sg, mhdr, sizeof(*mhdr)); |
492 | else | 492 | else |
493 | sg_init_one(sg, hdr, sizeof(*hdr)); | 493 | sg_set_buf(sg, hdr, sizeof(*hdr)); |
494 | 494 | ||
495 | num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; | 495 | num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; |
496 | 496 | ||