Message ID | 200901271521.19616.rusty@rustcorp.com.au |
---|---|
State | Accepted, archived |
Headers | show |
From: Rusty Russell <rusty@rustcorp.com.au> Date: Tue, 27 Jan 2009 15:21:19 +1030 > On Saturday 24 January 2009 10:40:53 Ira Snyder wrote: > > 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> > > Thanks, this should go in 2.6.29. Dave? Applied, should I queue it up for -stable too Rusty? Thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tuesday 27 January 2009 15:30:55 David Miller wrote: > From: Rusty Russell <rusty@rustcorp.com.au> > Date: Tue, 27 Jan 2009 15:21:19 +1030 > > > On Saturday 24 January 2009 10:40:53 Ira Snyder wrote: > > > 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> > > > > Thanks, this should go in 2.6.29. Dave? > > Applied, should I queue it up for -stable too Rusty? I don't think so. It really is defined as an sg array, not an sg chain. I'm happy to apply a little patch to make Ira's ongoing development easier, but no reason to panic about it. Thanks, Rusty. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 43f6523..67ea2cf 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -286,7 +286,7 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi) skb_put(skb, MAX_PACKET_LEN); hdr = skb_vnet_hdr(skb); - sg_init_one(sg, hdr, sizeof(*hdr)); + sg_set_buf(sg, hdr, sizeof(*hdr)); if (vi->big_packets) { for (i = 0; i < MAX_SKB_FRAGS; i++) { @@ -487,9 +487,9 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb) /* Encode metadata header at front. */ if (vi->mergeable_rx_bufs) - sg_init_one(sg, mhdr, sizeof(*mhdr)); + sg_set_buf(sg, mhdr, sizeof(*mhdr)); else - sg_init_one(sg, hdr, sizeof(*hdr)); + sg_set_buf(sg, hdr, sizeof(*hdr)); num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;