mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Merge tag 'xsa531+532-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross: "Two fixes for the xen-netback driver. One is a UAF (again - I failed doing a complete fix last week), and one a possible double unmap of a guest's ring-page, resulting in DoS of the host or another guest" * tag 'xsa531+532-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen-netback: Zero out sring pointers on unmap xen-netback: Fix XenBus connection failure cleanup
This commit is contained in:
@@ -1530,12 +1530,17 @@ static inline bool tx_dealloc_work_todo(struct xenvif_queue *queue)
|
||||
|
||||
void xenvif_unmap_frontend_data_rings(struct xenvif_queue *queue)
|
||||
{
|
||||
if (queue->tx.sring)
|
||||
if (queue->tx.sring) {
|
||||
xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(queue->vif),
|
||||
queue->tx.sring);
|
||||
if (queue->rx.sring)
|
||||
queue->tx.sring = NULL;
|
||||
}
|
||||
|
||||
if (queue->rx.sring) {
|
||||
xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(queue->vif),
|
||||
queue->rx.sring);
|
||||
queue->rx.sring = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int xenvif_map_frontend_data_rings(struct xenvif_queue *queue,
|
||||
|
||||
@@ -731,6 +731,7 @@ static void connect(struct backend_info *be)
|
||||
unsigned int queue_index;
|
||||
unsigned int requested_num_queues;
|
||||
struct xenvif_queue *queue;
|
||||
unsigned int num_queues;
|
||||
|
||||
/* Check whether the frontend requested multiple queues
|
||||
* and read the number requested.
|
||||
@@ -837,14 +838,15 @@ static void connect(struct backend_info *be)
|
||||
return;
|
||||
|
||||
err:
|
||||
if (be->vif->num_queues > 0)
|
||||
num_queues = be->vif->num_queues;
|
||||
if (num_queues > 0)
|
||||
xenvif_disconnect_data(be->vif); /* Clean up existing queues */
|
||||
be->vif->num_queues = 0;
|
||||
synchronize_net();
|
||||
for (queue_index = 0; queue_index < be->vif->num_queues; ++queue_index)
|
||||
for (queue_index = 0; queue_index < num_queues; ++queue_index)
|
||||
xenvif_deinit_queue(&be->vif->queues[queue_index]);
|
||||
vfree(be->vif->queues);
|
||||
be->vif->queues = NULL;
|
||||
be->vif->num_queues = 0;
|
||||
xenvif_disconnect_ctrl(be->vif);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user