Commit a3ed2a15 authored by André Goddard Rosa's avatar André Goddard Rosa Committed by Linus Torvalds
Browse files

mqueue: fix kernel BUG caused by double free() on mq_open()

In case of aborting because we reach the maximum amount of memory which
can be allocated to message queues per user (RLIMIT_MSGQUEUE), we would
try to free the message area twice when bailing out: first by the error
handling code itself, and then later when cleaning up the inode through
Signed-off-by: default avatarAndré Goddard Rosa <>
Cc: Alexey Dobriyan <>
Cc: Al Viro <>
Cc: <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent de145b44
......@@ -158,7 +158,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
u->mq_bytes + mq_bytes >
task_rlimit(p, RLIMIT_MSGQUEUE)) {
/* mqueue_delete_inode() releases info->messages */
goto out_inode;
u->mq_bytes += mq_bytes;
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