Commit 990e3971 authored by Chris Wright's avatar Chris Wright Committed by Linus Torvalds

[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.
parent dae1a193
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment