public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix sys_swapon() error handling in 2.5.2-dj6
@ 2002-01-30  8:09 Andrey Panin
  0 siblings, 0 replies; only message in thread
From: Andrey Panin @ 2002-01-30  8:09 UTC (permalink / raw)
  To: linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 277 bytes --]


Hi all,

error path in sys_swapon() can pass negative error code to filp_close() 
which generates an oops, oneliner patch attached.

Best regards.

-- 
Andrey Panin            | Embedded systems software engineer
pazke@orbita1.ru        | PGP key: wwwkeys.eu.pgp.net

[-- Attachment #1.2: patch-swapon --]
[-- Type: text/plain, Size: 378 bytes --]

diff -urN -X /usr/dontdiff /linux.vanilla/mm/swapfile.c /linux/mm/swapfile.c
--- /linux.vanilla/mm/swapfile.c	Wed Jan 30 01:07:49 2002
+++ /linux/mm/swapfile.c	Tue Jan 29 21:23:46 2002
@@ -1073,7 +1073,7 @@
 	swap_list_unlock();
 	if (swap_map)
 		vfree(swap_map);
-	if (swap_file)
+	if (swap_file && !IS_ERR(swap_file))
 		filp_close(swap_file, NULL);
 out:
 	if (swap_header)

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

only message in thread, other threads:[~2002-01-30  8:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-30  8:09 [PATCH] fix sys_swapon() error handling in 2.5.2-dj6 Andrey Panin

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