fs: fix lock initialization
commit9f8cc942aafab2f90c3ff42e1921691b8212fa5e
authorMiklos Szeredi <mszeredi@suse.cz>
Wed, 6 Jul 2011 10:33:55 +0000 (6 12:33 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 9 Jul 2011 06:15:32 +0000 (8 23:15 -0700)
tree1d15b586f4af0f4f8519f1a46e9aa90175433496
parentae852760d3e8a170226f30badad6777ec2c1d847
fs: fix lock initialization

commit a51cb91d81f8e6fc4e5e08b772cc3ceb13ac9d37 upstream.

locks_alloc_lock() assumed that the allocated struct file_lock is
already initialized to zero members.  This is only true for the first
allocation of the structure, after reuse some of the members will have
random values.

This will for example result in passing random fl_start values to
userspace in fuse for FL_FLOCK locks, which is an information leak at
best.

Fix by reinitializing those members which may be non-zero after freeing.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/locks.c