linux-uconsole/include
Mel Gorman cedd186e31 mempolicy: fix a race in shared_policy_replace()
commit b22d127a39 upstream.

shared_policy_replace() use of sp_alloc() is unsafe.  1) sp_node cannot
be dereferenced if sp->lock is not held and 2) another thread can modify
sp_node between spin_unlock for allocating a new sp node and next
spin_lock.  The bug was introduced before 2.6.12-rc2.

Kosaki's original patch for this problem was to allocate an sp node and
policy within shared_policy_replace and initialise it when the lock is
reacquired.  I was not keen on this approach because it partially
duplicates sp_alloc().  As the paths were sp->lock is taken are not that
performance critical this patch converts sp->lock to sp->mutex so it can
sleep when calling sp_alloc().

[kosaki.motohiro@jp.fujitsu.com: Original patch]
Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Cc: Josh Boyer <jwboyer@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-13 05:28:14 +09:00
..
acpi ACPI: Store SRAT table revision 2012-01-25 17:24:57 -08:00
asm-generic mutex: Place lock in contended state after fastpath_lock failure 2012-10-02 09:47:39 -07:00
crypto
drm drm/radeon/kms: add new BTC PCI ids 2012-06-10 00:33:04 +09:00
keys
linux mempolicy: fix a race in shared_policy_replace() 2012-10-13 05:28:14 +09:00
math-emu
media [media] tuner-core/v4l2-subdev: document that the type field has to be filled in 2011-07-07 15:04:23 -03:00
mtd
net xfrm: Workaround incompatibility of ESN and async crypto 2012-10-13 05:28:03 +09:00
pcmcia
rdma Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband 2011-05-26 12:13:57 -07:00
rxrpc
scsi [SCSI] libsas: Add option for SATA soft reset 2011-05-26 22:49:33 -05:00
sound ALSA: sb16 - Fix build errors on MIPS and others with 13bit ioctl size 2011-06-30 15:33:57 +02:00
target target: Set additional sense length field in sense data 2012-01-25 17:25:00 -08:00
trace tracing: Don't call page_to_pfn() if page is NULL 2012-10-02 09:47:27 -07:00
video OMAPDSS: HDMI: PHY burnout fix 2012-03-12 10:32:59 -07:00
xen xen/xenbus: Reject replies with payload > XENSTORE_PAYLOAD_MAX. 2012-01-25 17:24:41 -08:00
Kbuild