diff options
| author | Chris Wright <chrisw@osdl.org> | 2004-05-04 04:48:34 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-05-04 04:48:34 -0700 |
| commit | 990e3971f2b7850a9cef2853c7f96945ba7fa5e1 (patch) | |
| tree | b4e46aa06cbfa47dbbd97c3cd26679f43bbf30f3 /ipc/mqueue.c | |
| parent | dae1a193e4543ebbaceaa2eab56bf3d025097a8d (diff) | |
[PATCH] fix queues_count accounting in mqueue_delete_inode()
During mqueue_get_inode(), it's possible that kmalloc() of the
info->messages array will fail. This failure mode will cause the
queues_count to be (incorrectly) decremented twice. This patch uses
info->messages on mqueue_delete_inode() to determine whether the
mqueue was every truly created, and hence proper accounting is needed
on destruction.
Diffstat (limited to 'ipc/mqueue.c')
| -rw-r--r-- | ipc/mqueue.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index d13a9f37e145..f7acbb55b873 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -215,9 +215,11 @@ static void mqueue_delete_inode(struct inode *inode) clear_inode(inode); - spin_lock(&mq_lock); - queues_count--; - spin_unlock(&mq_lock); + if (info->messages) { + spin_lock(&mq_lock); + queues_count--; + spin_unlock(&mq_lock); + } } static int mqueue_create(struct inode *dir, struct dentry *dentry, |
