]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hpfs: deadlock and race in directory lseek()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 18 May 2013 06:38:52 +0000 (02:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Feb 2014 19:51:18 +0000 (11:51 -0800)
commitd5c20298b6d817b069c69d94df9cd8ed76b2ff15
tree382888a2b0d864b98998fd9a50419b153da6bbaf
parentd7c16d1e0a33ea79d9dc33e3f13f41b4f5caa756
hpfs: deadlock and race in directory lseek()

commit 31abdab9c11bb1694ecd1476a7edbe8e964d94ac upstream.

For one thing, there's an ABBA deadlock on hpfs fs-wide lock and i_mutex
in hpfs_dir_lseek() - there's a lot of methods that grab the former with
the caller already holding the latter, so it must take i_mutex first.

For another, locking the damn thing, carefully validating the offset,
then dropping locks and assigning the offset is obviously racy.

Moreover, we _must_ do hpfs_add_pos(), or the machinery in dnode.c
won't modify the sucker on B-tree surgeries.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/hpfs/dir.c