mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fix memleak in sys_mq_timedsend
@ 2004-05-05  0:42 Chris Wright
  2004-05-05  0:47 ` [PATCH] fix queues_count accounting in mqueue_delete_inode() Chris Wright
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Wright @ 2004-05-05  0:42 UTC (permalink / raw)
  To: manfred; +Cc: akpm, torvalds, linux-kernel

Move error handling to capture all three possible error conditions on
sending to a full queue.  Without this fix any unprivileged user can
leak arbitrary amounts of kernel memory.

--- ./ipc/mqueue.c~fix_memleak	2004-05-04 15:08:52.000000000 -0700
+++ ./ipc/mqueue.c	2004-05-04 15:10:59.000000000 -0700
@@ -811,9 +811,9 @@ asmlinkage long sys_mq_timedsend(mqd_t m
 			wait.msg = (void *) msg_ptr;
 			wait.state = STATE_NONE;
 			ret = wq_sleep(info, SEND, timeout, &wait);
-			if (ret < 0)
-				free_msg(msg_ptr);
 		}
+		if (ret < 0)
+			free_msg(msg_ptr);
 	} else {
 		receiver = wq_get_first_waiter(info, RECV);
 		if (receiver) {


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-05-05 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-05  0:42 [PATCH] fix memleak in sys_mq_timedsend Chris Wright
2004-05-05  0:47 ` [PATCH] fix queues_count accounting in mqueue_delete_inode() Chris Wright
2004-05-05  1:06   ` [PATCH] simplify mqueue_inode_info->messages allocation Chris Wright
2004-05-05  1:37     ` Chris Wright
2004-05-05 13:55       ` Marcelo Tosatti
2004-05-05 22:30         ` Chris Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®