]> err.no Git - linux-2.6/commit
[POWERPC] spufs: Fix context destroy vs /spu readdir race
authorJeremy Kerr <jk@ozlabs.org>
Fri, 16 Nov 2007 02:32:23 +0000 (13:32 +1100)
committerPaul Mackerras <paulus@samba.org>
Tue, 20 Nov 2007 05:10:20 +0000 (16:10 +1100)
commitc443acab2eebf12dce7e78fe29e76786f55ad1be
treec740b3e4ee8c75ade937b2c8fc9fcbeb7f87cfe6
parenta2b51812a4dc5db09ab4d4638d4d8ed456e2457e
[POWERPC] spufs: Fix context destroy vs /spu readdir race

We can currently cause an oops by repeatedly creating and destroying
contexts, while doing getdents() calls on the "/spu" directory.

This is due to the context's top-level dentry remaining hashed while
the context is being destroyed.

Fix this by unhashing the context's dentry with the
dentry->d_inode->i_mutex held. This way, we'll hit the check for
d_unhashed in dentry_readdir, and won't be included in the
list of subdirs for /spu.

test: spufs-testsuite:tests/01-spu_create/07-destroy-vs-readdir-race

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/cell/spufs/inode.c