]> Git Repo - linux.git/commit
[PATCH] holepunch: fix mmap_sem i_mutex deadlock
authorHugh Dickins <[email protected]>
Thu, 29 Mar 2007 08:20:38 +0000 (01:20 -0700)
committerLinus Torvalds <[email protected]>
Thu, 29 Mar 2007 15:22:26 +0000 (08:22 -0700)
commit90ed52ebe48181d3c5427b3bd1d24f659e7575ad
treebfb735ab12ebe7964714c637bcb64163646cd347
parent16a100190d39592d1d56ff5a0b978b20288c3427
[PATCH] holepunch: fix mmap_sem i_mutex deadlock

sys_madvise has down_write of mmap_sem, then madvise_remove calls
vmtruncate_range which takes i_mutex and i_alloc_sem: no, we can easily devise
deadlocks from that ordering.

madvise_remove drop mmap_sem while calling vmtruncate_range: luckily, since
madvise_remove doesn't split or merge vmas, it's easy to handle this case with
a NULL prev, without restructuring sys_madvise.  (Though sad to retake
mmap_sem when it's unlikely to be needed, and certainly down_read is
sufficient for MADV_REMOVE, unlike the other madvices.)

Signed-off-by: Hugh Dickins <[email protected]>
Cc: Miklos Szeredi <[email protected]>
Cc: Badari Pulavarty <[email protected]>
Cc: Nick Piggin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/madvise.c
This page took 0.051112 seconds and 4 git commands to generate.