]> pilppa.com Git - linux-2.6-omap-h63xx.git/commit
[PATCH] fuse: fix bitfield race
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 17 Jan 2006 06:14:52 +0000 (22:14 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 17 Jan 2006 07:15:31 +0000 (23:15 -0800)
commit095da6cbb6a1c54c19b11190218eb0fbac666b6d
tree29ba46cea17454fe1888182f6722aee64e1a7ef5
parentbacac382fbf53f717ca7f83558e45cce44e67df9
[PATCH] fuse: fix bitfield race

Fix race in setting bitfields of fuse_conn.  Spotted by Andrew Morton.

The two fields ->connected and ->mounted were always changed with the
fuse_lock held.  But other bitfields in the same structure were changed
without the lock.  In theory this could lead to losing the assignment of
even the ones under lock.  The chosen solution is to change these two
fields to be a full unsigned type.  The other bitfields aren't "important"
enough to warrant the extra complexity of full locking or changing them to
bitops.

For all bitfields document why they are safe wrt. concurrent
assignments.

Also make the initialization of the 'num_waiting' atomic counter explicit.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/fuse/fuse_i.h
fs/fuse/inode.c