android_kernel_motorola_sm6225/drivers/xen
Daniel De Graaf 1f1503ba09 xen/gntdev: Fix sleep-inside-spinlock
BUG: sleeping function called from invalid context at /local/scratch/dariof/linux/kernel/mutex.c:271
in_atomic(): 1, irqs_disabled(): 0, pid: 3256, name: qemu-dm
1 lock held by qemu-dm/3256:
 #0:  (&(&priv->lock)->rlock){......}, at: [<ffffffff813223da>] gntdev_ioctl+0x2bd/0x4d5
Pid: 3256, comm: qemu-dm Tainted: G        W   3.1.0-rc8+ #5
Call Trace:
 [<ffffffff81054594>] __might_sleep+0x131/0x135
 [<ffffffff816bd64f>] mutex_lock_nested+0x25/0x45
 [<ffffffff8131c7c8>] free_xenballooned_pages+0x20/0xb1
 [<ffffffff8132194d>] gntdev_put_map+0xa8/0xdb
 [<ffffffff816be546>] ? _raw_spin_lock+0x71/0x7a
 [<ffffffff813223da>] ? gntdev_ioctl+0x2bd/0x4d5
 [<ffffffff8132243c>] gntdev_ioctl+0x31f/0x4d5
 [<ffffffff81007d62>] ? check_events+0x12/0x20
 [<ffffffff811433bc>] do_vfs_ioctl+0x488/0x4d7
 [<ffffffff81007d4f>] ? xen_restore_fl_direct_reloc+0x4/0x4
 [<ffffffff8109168b>] ? lock_release+0x21c/0x229
 [<ffffffff81135cdd>] ? rcu_read_unlock+0x21/0x32
 [<ffffffff81143452>] sys_ioctl+0x47/0x6a
 [<ffffffff816bfd82>] system_call_fastpath+0x16/0x1b

gntdev_put_map tries to acquire a mutex when freeing pages back to the
xenballoon pool, so it cannot be called with a spinlock held. In
gntdev_release, the spinlock is not needed as we are freeing the
structure later; in the ioctl, only the list manipulation needs to be
under the lock.

Reported-and-Tested-By: Dario Faggioli <dario.faggioli@citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
2011-10-14 10:02:10 -04:00
..
xen-pciback xen/pciback: remove duplicated #include 2011-08-03 14:34:52 -04:00
xenbus xen: Add module alias to autoload backend drivers 2011-06-30 12:15:33 -04:00
xenfs Merge branch 'xen/xenbus' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen 2011-01-20 16:37:28 -08:00
balloon.c xen: add an "highmem" parameter to alloc_xenballooned_pages 2011-09-29 09:56:52 -04:00
biomerge.c xen: define BIOVEC_PHYS_MERGEABLE() 2010-10-18 10:40:28 -04:00
cpu_hotplug.c Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2009-12-11 12:18:16 -08:00
events.c xen/pci: Remove 'xen_allocate_pirq_gsi'. 2011-07-11 13:19:33 -04:00
evtchn.c treewide: remove extra semicolons 2011-04-10 17:01:05 +02:00
features.c xen: clean up asm/xen/hypervisor.h 2008-12-16 21:50:31 +01:00
gntalloc.c xen/gntdev,gntalloc: Remove unneeded VM flags 2011-03-09 22:15:28 -05:00
gntdev.c xen/gntdev: Fix sleep-inside-spinlock 2011-10-14 10:02:10 -04:00
grant-table.c xen: modify kernel mappings corresponding to granted pages 2011-09-29 10:32:58 -04:00
Kconfig xen/self-balloon: Add dependency on tmem. 2011-08-03 14:34:57 -04:00
Makefile Merge branch 'stable/xen-pciback-0.6.3' into stable/drivers 2011-07-20 15:33:51 -04:00
manage.c PM: Remove sysdev suspend, resume and shutdown operations 2011-05-11 21:37:15 +02:00
pci.c xen: register xen pci notifier 2010-10-27 18:56:07 +01:00
platform-pci.c xen: no need to delay xen_setup_shutdown_event for hvm guests anymore 2011-02-25 16:43:03 +00:00
swiotlb-xen.c Merge branch 'stable/xen-swiotlb.bugfix' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb-2.6 2011-06-09 12:52:44 -07:00
sys-hypervisor.c drivers/xen/sys-hypervisor: Cleanup code/data sections definitions 2011-05-19 11:30:41 -04:00
tmem.c xen: prepare tmem shim to handle frontswap 2011-06-17 15:06:20 -06:00
xen-balloon.c xen: tmem: self-ballooning and frontswap-selfshrinking 2011-07-08 12:26:21 -06:00
xen-selfballoon.c xen/balloon: Fix compile errors - missing header files. 2011-08-03 14:34:55 -04:00
xencomm.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00