Skip to content

Commit

Permalink
ipc/shm.c: fix overly aggressive shmdt() when calls span multiple seg…
Browse files Browse the repository at this point in the history
…ments

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 <[email protected]>
Cc: Manfred Spraul <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
hansendc authored and hnaz committed Nov 13, 2014
1 parent b5b2a1f commit b8abdfe

Sorry, this diff is temporarily unavailable due to heavy server load.

Please try again later.

0 comments on commit b8abdfe

Please sign in to comment.