Commit 90f1e748 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'stable/bug-fixes-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen

* 'stable/bug-fixes-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  xen: Use new irq_move functions
  xen: Convert genirq namespace
  xen: fix p2m section mismatches
  xen/p2m: Allocate p2m tracking pages on override
  xen-gntdev: unlock on error path in gntdev_mmap()
  xen-gntdev: return -EFAULT on copy_to_user failure
parents d6ae0c63 e240ae4a
...@@ -497,7 +497,7 @@ static bool alloc_p2m(unsigned long pfn) ...@@ -497,7 +497,7 @@ static bool alloc_p2m(unsigned long pfn)
return true; return true;
} }
bool __early_alloc_p2m(unsigned long pfn) static bool __init __early_alloc_p2m(unsigned long pfn)
{ {
unsigned topidx, mididx, idx; unsigned topidx, mididx, idx;
...@@ -530,7 +530,7 @@ bool __early_alloc_p2m(unsigned long pfn) ...@@ -530,7 +530,7 @@ bool __early_alloc_p2m(unsigned long pfn)
} }
return idx != 0; return idx != 0;
} }
unsigned long set_phys_range_identity(unsigned long pfn_s, unsigned long __init set_phys_range_identity(unsigned long pfn_s,
unsigned long pfn_e) unsigned long pfn_e)
{ {
unsigned long pfn; unsigned long pfn;
...@@ -671,7 +671,9 @@ int m2p_add_override(unsigned long mfn, struct page *page) ...@@ -671,7 +671,9 @@ int m2p_add_override(unsigned long mfn, struct page *page)
page->private = mfn; page->private = mfn;
page->index = pfn_to_mfn(pfn); page->index = pfn_to_mfn(pfn);
__set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)); if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
return -ENOMEM;
if (!PageHighMem(page)) if (!PageHighMem(page))
/* Just zap old mapping for now */ /* Just zap old mapping for now */
pte_clear(&init_mm, address, ptep); pte_clear(&init_mm, address, ptep);
...@@ -709,7 +711,7 @@ int m2p_remove_override(struct page *page) ...@@ -709,7 +711,7 @@ int m2p_remove_override(struct page *page)
spin_lock_irqsave(&m2p_override_lock, flags); spin_lock_irqsave(&m2p_override_lock, flags);
list_del(&page->lru); list_del(&page->lru);
spin_unlock_irqrestore(&m2p_override_lock, flags); spin_unlock_irqrestore(&m2p_override_lock, flags);
__set_phys_to_machine(pfn, page->index); set_phys_to_machine(pfn, page->index);
if (!PageHighMem(page)) if (!PageHighMem(page))
set_pte_at(&init_mm, address, ptep, set_pte_at(&init_mm, address, ptep,
......
...@@ -273,7 +273,7 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages) ...@@ -273,7 +273,7 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
map->vma->vm_start + map->notify.addr; map->vma->vm_start + map->notify.addr;
err = copy_to_user(tmp, &err, 1); err = copy_to_user(tmp, &err, 1);
if (err) if (err)
return err; return -EFAULT;
map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE; map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
} else if (pgno >= offset && pgno < offset + pages) { } else if (pgno >= offset && pgno < offset + pages) {
uint8_t *tmp = kmap(map->pages[pgno]); uint8_t *tmp = kmap(map->pages[pgno]);
...@@ -662,7 +662,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) ...@@ -662,7 +662,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
if (map->flags) { if (map->flags) {
if ((vma->vm_flags & VM_WRITE) && if ((vma->vm_flags & VM_WRITE) &&
(map->flags & GNTMAP_readonly)) (map->flags & GNTMAP_readonly))
return -EINVAL; goto out_unlock_put;
} else { } else {
map->flags = GNTMAP_host_map; map->flags = GNTMAP_host_map;
if (!(vma->vm_flags & VM_WRITE)) if (!(vma->vm_flags & VM_WRITE))
...@@ -700,6 +700,8 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) ...@@ -700,6 +700,8 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
spin_unlock(&priv->lock); spin_unlock(&priv->lock);
return err; return err;
out_unlock_put:
spin_unlock(&priv->lock);
out_put_map: out_put_map:
if (use_ptemod) if (use_ptemod)
map->vma = NULL; map->vma = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment