mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] for error-case kernel fault in sys_swapon
@ 2004-03-15 11:55 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2004-03-15 11:55 UTC (permalink / raw)
  To: linux-kernel

In the epilogue code, 'name' was passed to putname() regardless of
whether getname() succeeded, whereas 'swap_file' was cleared to NULL and
nevertheless checked through IS_ERR(). The patch fixes the first and
streamlines the second.

Jan Beulich
Novell, Inc.

--- 2.6.3/mm/swapfile.c.0	2004-03-02 16:35:17.000000000 +0100
+++ 2.6.3/mm/swapfile.c	2004-03-15 12:46:12.597498944 +0100
@@ -1269,8 +1269,10 @@
 	swap_list_unlock();
 	name = getname(specialfile);
 	error = PTR_ERR(name);
-	if (IS_ERR(name))
+	if (IS_ERR(name)) {
+		name = NULL;
 		goto bad_swap_2;
+	}
 	swap_file = filp_open(name, O_RDWR, 0);
 	error = PTR_ERR(swap_file);
 	if (IS_ERR(swap_file)) {
@@ -1456,7 +1458,7 @@
 	destroy_swap_extents(p);
 	if (swap_map)
 		vfree(swap_map);
-	if (swap_file && !IS_ERR(swap_file))
+	if (swap_file)
 		filp_close(swap_file, NULL);
 out:
 	if (page && !IS_ERR(page)) {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-03-15 11:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-15 11:55 [PATCH] for error-case kernel fault in sys_swapon Jan Beulich

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®