All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] [patch 1/2] Uml - first part rework of run_helper() and users.
@ 2004-11-30 20:08 blaisorblade_spam
  2004-11-30 23:20 ` [uml-devel] " Andrew Morton
  0 siblings, 1 reply; 11+ messages in thread
From: blaisorblade_spam @ 2004-11-30 20:08 UTC (permalink / raw)
  To: akpm; +Cc: jdike, bstroesser, user-mode-linux-devel, blaisorblade_spam


From: Jeff Dike <jdike@addtoit.com>, Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>

Fixed a file descriptor leak in the network driver when changing an IP
address.

Fixed the error handling in run_helper.


Paolo notes:

Actually, this is part one of the change, the exact one extracted from Jeff
Dike's incrementals tree before 2.6.9-rc big UML merge.

There is some changes must be done, so I'm also sending a second patch with
this one, too. Separated for tracking purposes.

Don't send this pair of ones to Linus before Jeff ACK's it - just put into -mm for now.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
---

 linux-2.6.10-rc-paolo/arch/um/drivers/net_user.c |    3 ++-
 linux-2.6.10-rc-paolo/arch/um/kernel/helper.c    |   14 +++++---------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff -puN arch/um/drivers/net_user.c~uml-orig-helper-rework arch/um/drivers/net_user.c
--- linux-2.6.10-rc/arch/um/drivers/net_user.c~uml-orig-helper-rework	2004-11-30 20:43:45.701552240 +0100
+++ linux-2.6.10-rc-paolo/arch/um/drivers/net_user.c	2004-11-30 21:08:14.756221984 +0100
@@ -173,8 +173,9 @@ static int change_tramp(char **argv, cha
 	pe_data.stdout = fds[1];
 	pid = run_helper(change_pre_exec, &pe_data, argv, NULL);
 
-	os_close_file(fds[1]);
 	read_output(fds[0], output, output_len);
+	os_close_file(fds[0]);
+	os_close_file(fds[1]);
 
 	CATCH_EINTR(err = waitpid(pid, NULL, 0));
 	return(pid);
diff -puN arch/um/kernel/helper.c~uml-orig-helper-rework arch/um/kernel/helper.c
--- linux-2.6.10-rc/arch/um/kernel/helper.c~uml-orig-helper-rework	2004-11-30 20:43:45.703551936 +0100
+++ linux-2.6.10-rc-paolo/arch/um/kernel/helper.c	2004-11-30 21:08:14.755222136 +0100
@@ -94,24 +94,20 @@ int run_helper(void (*pre_exec)(void *),
 	if(n < 0){
 		printk("run_helper : read on pipe failed, err = %d\n", -n);
 		err = n;
-		goto out_kill;
+		os_kill_process(pid, 1);
 	}
 	else if(n != 0){
 		CATCH_EINTR(n = waitpid(pid, NULL, 0));
 		pid = -errno;
 	}
+	err = pid;
 
-	if(stack_out == NULL) free_stack(stack, 0);
-        else *stack_out = stack;
-	return(pid);
-
- out_kill:
-	os_kill_process(pid, 1);
  out_close:
 	os_close_file(fds[0]);
-	os_close_file(fds[1]);
  out_free:
-	free_stack(stack, 0);
+	if(stack_out == NULL)
+		free_stack(stack, 0);
+        else *stack_out = stack;
 	return(err);
 }
 
_


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

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

end of thread, other threads:[~2004-12-01 23:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-30 20:08 [uml-devel] [patch 1/2] Uml - first part rework of run_helper() and users blaisorblade_spam
2004-11-30 23:20 ` [uml-devel] " Andrew Morton
2004-12-01  0:20   ` [uml-devel] VFS interactions with UML and other big UML changes (was: Re: [patch 1/2] Uml - first part rework of run_helper() and users.) Blaisorblade
2004-12-01  0:20     ` Blaisorblade
2004-12-01  0:33     ` [uml-devel] " Andrew Morton
2004-12-01  0:33       ` Andrew Morton
2004-12-01  0:51       ` [uml-devel] " Blaisorblade
2004-12-01  0:51         ` Blaisorblade
2004-12-01  9:02     ` Gerd Knorr
2004-12-01  9:02       ` Gerd Knorr
2004-12-02  1:41   ` [uml-devel] Re: [patch 1/2] Uml - first part rework of run_helper() and users Jeff Dike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.