[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/6] xen-netfront: do not use data already exposed to backend



Backend may freely modify anything on shared page, so use data which was
supposed to be written there, instead of reading it back from the shared
page.

This is complementary to XSA155.

CC: stable@xxxxxxxxxxxxxxx
Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 drivers/net/xen-netfront.c |  9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index dc99763..934b8a4 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -458,7 +458,7 @@ static void xennet_tx_setup_grant(unsigned long gfn, 
unsigned int offset,
        tx->flags = 0;
 
        info->tx = tx;
-       info->size += tx->size;
+       info->size += len;
 }
 
 static struct xen_netif_tx_request *xennet_make_first_txreq(
@@ -574,7 +574,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct 
net_device *dev)
        int slots;
        struct page *page;
        unsigned int offset;
-       unsigned int len;
+       unsigned int len, this_len;
        unsigned long flags;
        struct netfront_queue *queue = NULL;
        unsigned int num_queues = dev->real_num_tx_queues;
@@ -634,14 +634,15 @@ static int xennet_start_xmit(struct sk_buff *skb, struct 
net_device *dev)
        }
 
        /* First request for the linear area. */
+       this_len = min_t(unsigned int, XEN_PAGE_SIZE - offset, len);
        first_tx = tx = xennet_make_first_txreq(queue, skb,
                                                page, offset, len);
-       offset += tx->size;
+       offset += this_len;
        if (offset == PAGE_SIZE) {
                page++;
                offset = 0;
        }
-       len -= tx->size;
+       len -= this_len;
 
        if (skb->ip_summed == CHECKSUM_PARTIAL)
                /* local packet? */
-- 
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.