From: Dave Hansen Date: Sat, 13 Dec 2014 00:58:19 +0000 (-0800) Subject: ipc/shm.c: fix overly aggressive shmdt() when calls span multiple segments X-Git-Tag: omap-for-v3.19/fixes-rc1~100^2~11 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3c97900b427b8d5a476fdfe484267f09df418d6;p=pandora-kernel.git ipc/shm.c: fix overly aggressive shmdt() when calls span multiple segments This is a highly-contrived scenario. But, a single shmdt() call can be induced in to unmapping memory from mulitple shm segments. Example code is here: http://www.sr71.net/~dave/intel/shmfun.c The fix is pretty simple: Record the 'struct file' for the first VMA we encounter and then stick to it. Decline to unmap anything not from the same file and thus the same segment. I found this by inspection and the odds of anyone hitting this in practice are pretty darn small. Lightly tested, but it's a pretty small patch. Signed-off-by: Dave Hansen Cc: Manfred Spraul Reviewed-by: Davidlohr Bueso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed