ipc, shm: guard against non-existant vma in shmdt(2)
authorDavidlohr Bueso <davidlohr.bueso@hp.com>
Wed, 11 Sep 2013 21:26:28 +0000 (14:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Sep 2013 22:59:44 +0000 (15:59 -0700)
commit530fcd16d87cd2417c472a581ba5a1e501556c86
treec741f07d57e5b6fdf5920c6ba87e59b779073aaf
parent05603c44a7627793219b0bd9a7b236099dc9cd9d
ipc, shm: guard against non-existant vma in shmdt(2)

When !CONFIG_MMU there's a chance we can derefence a NULL pointer when the
VM area isn't found - check the return value of find_vma().

Also, remove the redundant -EINVAL return: retval is set to the proper
return code and *only* changed to 0, when we actually unmap the segments.

Signed-off-by: Davidlohr Bueso <davidlohr.bueso@hp.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ipc/shm.c