swapfile.c
PATCH 1/1 swapfile.c
In 2.5.2 swapfile.c was broken:
In sys_swapon() we see
swap_file = filp_open(name, O_RDWR, 0); if (IS_ERR(swap_file)) goto bad_swap_2;
bad_swap_2:
... if (swap_file) filp_close(swap_file, NULL);
and this oopses the kernel.
Below a trivial fix. Somebody with more time may come back and polish stuff a little.
Andries
swapfile.c renamed from swapfile.c~ +3 -1
@@ -905,8 +905,10 @@ swap_file =filp_open (name,O_RDWR ,0 );putname (name); error =PTR_ERR (swap_file); -if (IS_ERR (swap_file)) +if (IS_ERR (swap_file)) { + swap_file =NULL ; goto bad_swap_2; + } p->swap_file = swap_file;
[this was a patch relative to 2.5.6-pre2]
Quoted 7 lines · On Сбт, Мар 02, 2002 at 09:25:16 +0000, [email protected] wrote:
In 2.5.2
swapfile.cwas broken:
Insys_swapon()we seeswap_file = filp_open(name, O_RDWR, 0); if (IS_ERR(swap_file)) goto bad_swap_2;
Quoted 6 lines
bad_swap_2:... if (swap_file) filp_close(swap_file, NULL);and this oopses the kernel.
Fixed in -dj tree.
Signature · 2 lines
Andrey Panin | Embedded systems software engineer [email protected] | PGP key: wwwkeys.eu.pgp.net
Quoted 8 lines · Andrey Panin
Quoted 7 lines · On Сбт, Мар 02, 2002 at 09:25:16 +0000, [email protected] wrote:
In 2.5.2
swapfile.cwas broken:
Insys_swapon()we seeswap_file = filp_open(name, O_RDWR, 0); if (IS_ERR(swap_file)) goto bad_swap_2;
Quoted 8 lines
Quoted 6 lines
bad_swap_2:... if (swap_file) filp_close(swap_file, NULL);and this oopses the kernel.
Fixed in -dj tree.
Eww, nice spotting Andries. If it is in the -dj tree, someone want to push that bit to Linus?
Robert Love
Quoted 3 lines · Robert Love
Quoted 1 line
Fixed in -dj tree.
Eww, nice spotting Andries. If it is in the -dj tree, someone want to push that bit to Linus?
Actually, I only just applied that to my tree last night. Possibly Andrey was mixing it up to the IS_ERR fix that went in a while ago..
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs