Skip to contentSkip to conversation

fix sys_swapon() error handling in 2.5.2-dj6

PATCH New Andrey Panin 1 participant 1 message Jan 30, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix sys_swapon() error handling in 2.5.2-dj6

Hi all,

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

Best regards.

Signature · 2 lines
Andrey Panin            | Embedded systems software engineer
[email protected]        | PGP key: wwwkeys.eu.pgp.net
linux/mm/swapfile.c renamed from linux.vanilla/mm/swapfile.c +1 -1
diff -urN -X /usr/dontdiff /linux.vanilla/mm/swapfile.c /linux/mm/swapfile.c
@@ -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)