diff options
author | Evgeny Kuznetsov <ext-eugeny.kuznetsov@nokia.com> | 2010-10-05 12:47:57 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-05 11:47:18 -0700 |
commit | 231d0aefd88e94129cb8fb84794f9bb788c6366e (patch) | |
tree | a97313f61b394f93413a9025e72de05179c0ef65 | |
parent | 5336377d6225959624146629ce3fc88ee8ecda3d (diff) | |
download | linux-3.10-231d0aefd88e94129cb8fb84794f9bb788c6366e.tar.gz linux-3.10-231d0aefd88e94129cb8fb84794f9bb788c6366e.tar.bz2 linux-3.10-231d0aefd88e94129cb8fb84794f9bb788c6366e.zip |
wait: using uninitialized member of wait queue
The "flags" member of "struct wait_queue_t" is used in several places in
the kernel code without beeing initialized by init_wait(). "flags" is
used in bitwise operations.
If "flags" not initialized then unexpected behaviour may take place.
Incorrect flags might used later in code.
Added initialization of "wait_queue_t.flags" with zero value into
"init_wait".
Signed-off-by: Evgeny Kuznetsov <EXT-Eugeny.Kuznetsov@nokia.com>
[ The bit we care about does end up being initialized by both
prepare_to_wait() and add_to_wait_queue(), so this doesn't seem to
cause actual bugs, but is definitely the right thing to do -Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/wait.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index 0836ccc5712..3efc9f3f43a 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -614,6 +614,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); (wait)->private = current; \ (wait)->func = autoremove_wake_function; \ INIT_LIST_HEAD(&(wait)->task_list); \ + (wait)->flags = 0; \ } while (0) /** |