linux-stable/include
Mel Gorman ee95c1dd19 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:47:21 +09:00
..
acpi ACPI: fix acpi_bus.h build warnings when ACPI is not enabled 2012-06-04 00:29:11 -04:00
asm-generic mutex: Place lock in contended state after fastpath_lock failure 2012-10-02 10:39:39 -07:00
crypto
drm drm: Check for invalid cursor flags 2012-10-02 10:39:41 -07:00
keys KEYS: Permit in-place link replacement in keyring list 2012-05-11 10:56:56 +01:00
linux mempolicy: fix a race in shared_policy_replace() 2012-10-13 05:47:21 +09:00
math-emu
media [media] patch for Asus My Cinema PS3-100 (1043:48cd) 2012-05-20 16:05:02 -03:00
memory ddr: add LPDDR2 data from JESD209-2 2012-05-02 00:04:06 -07:00
misc
mtd UBI: amend commentaries WRT dtype 2012-05-20 20:25:59 +03:00
net xfrm: Workaround incompatibility of ESN and async crypto 2012-10-13 05:46:58 +09:00
pcmcia
rdma Merge branches 'core', 'cxgb4', 'ipath', 'iser', 'lockdep', 'mlx4', 'nes', 'ocrdma', 'qib' and 'raw-qp' into for-linus 2012-05-21 09:00:47 -07:00
rxrpc
scsi [SCSI] libsas: fix taskfile corruption in sas_ata_qc_fill_rtf 2012-07-08 09:49:14 +01:00
sound Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2012-06-25 14:53:09 -07:00
target target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE 2012-08-09 08:22:35 -07:00
trace tracing: Don't call page_to_pfn() if page is NULL 2012-10-02 10:39:25 -07:00
video fbdev updates for 3.5 2012-06-01 16:57:51 -07:00
xen xen/m2p: do not reuse kmap_op->dev_bus_addr 2012-10-02 10:39:12 -07:00
Kbuild