Messages in this thread Patch in this message | | | Date | Tue, 4 May 2004 17:47:13 -0700 | From | Chris Wright <> | Subject | [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.
--- ./ipc/mqueue.c~fix_queues_count 2004-05-04 15:10:59.000000000 -0700 +++ ./ipc/mqueue.c 2004-05-04 15:16:34.000000000 -0700 @@ -215,9 +215,11 @@ static void mqueue_delete_inode(struct i 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, - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |