]> git.baikalelectronics.ru Git - kernel.git/commit
fs: d_validate fixes
authorNick Piggin <npiggin@kernel.dk>
Fri, 7 Jan 2011 06:49:16 +0000 (17:49 +1100)
committerNick Piggin <npiggin@kernel.dk>
Fri, 7 Jan 2011 06:50:16 +0000 (17:50 +1100)
commit94aa846057d7abc9f4a9209da69e4b8f1fb23edf
tree0c0100945f74ad1d68b9b546e1929cfcb67e9095
parentd96da447eb74929aeaff72b9d0adc6f26eb8dbd7
fs: d_validate fixes

d_validate has been broken for a long time.

kmem_ptr_validate does not guarantee that a pointer can be dereferenced
if it can go away at any time. Even rcu_read_lock doesn't help, because
the pointer might be queued in RCU callbacks but not executed yet.

So the parent cannot be checked, nor the name hashed. The dentry pointer
can not be touched until it can be verified under lock. Hashing simply
cannot be used.

Instead, verify the parent/child relationship by traversing parent's
d_child list. It's slow, but only ncpfs and the destaged smbfs care
about it, at this point.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
fs/dcache.c